Class Structure
Restrictions for Simplified Code Checks#
Inheritance Rules#
If these rules are not followed, code deployment will fail.
Field Usage Limitations#
In Contract Implementation Class#
Allowed:
1class MyContract : MyContractBase2{3int test;4static const int test = 2;5}
Not Allowed:
1class MyContract : MyContractBase2{3! int test = 2;4}
1class MyContract : MyContractBase2{3int test;45public MyContract6{7! test = 2;8}9}
In Non-Contract Classes (Classes not inheriting from ContractBase<T>)#
Allowed:
1class AnyClass2{3static int test;4}
Not Allowed:
1class AnyClass2{3! static int test = 2;4}
1class AnyClass2{3static int test;45public AnyClass6{7! test = 2;8}9}
Allowed:
1public class TestType2{3private static FileDescriptor test;45public class TestType6{7test = ...8}9}
Not Allowed:
1public class TestType2{3private static FileDescriptor test;45public TestType6{7test = ...8}910! public void SetFromSomeWhereElse(FileDescriptor input)11! {12! test = input;13! }14}
Note: T can only be a primitive type.
Allowed:
1public class TestType2{3private static readonly TestType test;45private static int i;6}
Not Allowed:
1public class TestType2{3private static readonly TestType test;45! private int i;6}
In Contract State#
In contract state, only the following types are allowed:
Primitive Types
Complex Types
Edited on: 15 July 2024 03:32:22 GMT+0