Skip to main content
Share Your Experience: Take the 2024 Developer Survey
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/...
confused00's user avatar
  • 5,554
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"...
Chuck's user avatar
  • 11
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/...
cmadh's user avatar
  • 1,929
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")("...
conr2d's user avatar
  • 2,320
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 ...
Andres Berrios's user avatar
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 , ...
Vladimir Venediktov's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible