6
votes
Accepted
How to store contract state as singleton?
If there is only one instance to be created, I agree you should use a singleton for your case instead of a table directly, as this is what singletons are used for.
For API, you can check the eosio/...
5
votes
Best practice to handle table migrations?
When making structural changes to tables there are 2 basic approaches:
add versioning in the data from day 1 and then support old versions of the data well enough to do "just in time" upgrades.
...
4
votes
How to allow duplicates in an eosio::multi_index object?
I guess your problem might be that you are saving the primary key as uint32_t but it has to be a uint64_t. Because it might be that if you try to save the id (0x00000000) it will cut the last 32 bits ...
tmm♦
- 2,114
1
vote
How to store contract state as singleton?
Yes, as you're saying, it should simply be a single table with a single row that contains your data as a struct with the 3 fields.
You would need to define your struct and table as something like ...
1
vote
Best practice to handle table migrations?
Binary_extension is a good choice when you need to add new fields in the table struct. But you should not remove fields in the middle of field-list in which case it could not retrieve table.
Actually ...
Only top scored, non community-wiki answers of a minimum length are eligible