I have N fundamental data storage variables for each user (AccountId) that must be stored in mappings and are accessed and modified during method calls (#ink[messege]) in a smart contract. Not all of these fundamental data storage variables are used in all methods.
- There are N fundamental data storage variables and 2 methods that modify them.
- 1st method modifies the first M<N of variables.
- 2nd method modifies all N variables.
- Both methods are called the same often.
I have few ideas on how to organize data in this case and I don't know which one to choose:
- Each variable is stored in a separate Mapping<AccountId, data_type>.
- I divide variables into 2 structs (or tuples) and I store these structs (tuples) in
- I divide variables into 2 structs (or tuples). Then I make a super-struct (super- tuple) that contains both of the previous structs (tuples). I have one Mapping<AccoundId, SuperStruct>
- All variables are stored in one struct (tuple) and there is only one mapping.
The question is how to organize that data to make accessing and modifying cheap (in gas)? Is it possible to give some general rules, or is it very case-dependent?