5

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/singleton.hpp file, and here's a quick example using a singleton: #include<eosio/eosio.hpp> #include<eosio/singleton.hpp> class singleton_example : ...


1

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")("first_approve", fa_obj)...


1

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 this: //@abi table state i64 struct state { string field1; string field2; uint64_t field3; // Set the primary key to a constant value to store ...


1

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 , second is a C++ type this singleton holds Singleton constructor Say if scope and code is the same and same as owner of a contract then use contract::_self or ...


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