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/...
1
vote
singleton table: "cannot create objects in table of another contract"
I found my problem, which is in the constructor
microBadge(name receiver, name code, datastream<const char *> ds) :
contract(receiver, code, ds),
calls("inits"...
1
vote
eosio::singleton, action was done, but the blockchain showed error and the singleton action modsettings did not processed
I cleaned up your question because it was unreadable. Please learn how to properly ask and format questions here.
The code you posted is still so badly formatted that it says the code for reading/...
1
vote
How to match object value from fc::variant which is std::pair type in contract unit test via Boost test?
You can pass variant_object to initialize the other variant_object.
For example,
auto fa_obj = mvo()("first", "apk")("second", 1);
REQUIRE_MATCHING_OBJECT(notary, mvo()("account", "ins")("...
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
How do you construct a singleton in dawn4?
I am not sure what you are trying to do , so I just made it compile for you.
template<uint64_t SingletonName, typename T>
class singleton
first parameter is N(simple) e.g. singleton name , ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
singleton × 5smart-contract × 1
unit-tests × 1
boost × 1
persistence-api × 1
dawn-4.0 × 1
persistence × 1
constructor × 1