Open fulldecent opened 5 years ago
The following snippet is from /developers/fundamentals/avm-concepts/initializable-fields.md:
Data supplied in the data field must be supplied in the exact same order as the @Initializable field are defined. If not, an ABIException will be thrown.
...
The static{} function will do the following in order:
- Instantiate an ABIDecoder with Blockchain.getData() and try to decode an Integer and a string;
- Set owner as the address that deployed the contract.
- Execute increaseMyIntByOne() and increase the value of myInt by one.
It looks to me that this addresses this issue. I'll leave this issue open for now for further comments however.
Within one contract it is clear that they are handled in the order defined.
But what is the order of the contracts?
In my test code I use
byte[] contractData = avmRule.getDappBytes(Main.class, data, AIP040Events.class, NFToken.class, NFTokenMock.class, NFTokenStorage.class, BigInteger.class);
Is that the order the the contracts are processed (and for each in the order defined in the files)? What happens if I don't have test code, is there different code that runs for deployment?
From https://docs.aion.network/docs/deployment-initialization
It is stated:
The order of the
static {}
blocks should be specified.