6

You can still post system contract but first activate that protocol feature for v1.8.x node: TLDR: add eosio::producer_api_plugin run curl -X POST http://127.0.0.1:8888/v1/producer/schedule_protocol_feature_activations -d '{"protocol_features_to_activate": ["0ec7e080177b2c02b278d5088611686b49d739925a92d9bfcacd7fc6b74053bd"]}' If it doesn't work: run ...


2

Abort Called is usually an indicating of a segmentation violation. So look for things like: accessing elements of a vector or pointer calling new or delete on objects that have already been created or deleted any of the other thousands of reasons why you can get a seg fault


2

You set get_first_receiver() as the scope of member_index. If this action is not sent by other contract, first_receiver will be the account where the contract is deployed. [[eosio::action]] void upsert(name user, std::string first_name, std::string last_name, std::string contact, std::string address) { require_auth( user ); // 2nd argument here is the ...


2

The correct library is now #include <eosio/crypto.hpp>


2

EOSIO.CDT doesn't support std::array in function argument or field of multi_index struct. You can try my customized version of cdt, eoscc which supports std::array. If you want to use official EOSIO.CDT, you had better use std::vector, but limit the number of items by yourself.


2

If you use a custom type you must also define the type to a built in type. A list of accepted types by EOSIO can be found here, https://eosio.stackexchange.com/a/1932/3333. For instance, your custom enum is actually a uint8_t type. You'll need something like .. ## header file enum e_vote_option { upvote = 0, downvote } typedef uint8_t vote_option; ...


2

cleos set contract --help Specifically you want --clear You are required to manually clear the contract tables if you no longer want the data. Clearing a contract with existing data will not remove the RAM used to store the data in tables.


2

Usually, you don't need to implement dispatcher by yourself. [[eosio::action]] and [[eosio::on_notify]] will generate a proper action dispatcher automatically. There were some security accidents by writing incomplete action dispatcher. If you don't know what you are doing exactly, it's better to rely on automatic generation of action dispatcher by eosio-cpp. ...


1

the problem is coming from beforeEach function => you are deploying each time a new contract and it throws, because you are creating your user only in the first test suite Solutions: Replace beforeEach with before Create a user in each of your tests


1

Your action "bet" provoke two authorities if you use "username" account other than contract account. permission_level(_self, "active"_n), Here in this line, action caller must have authority of contract account and on the other hand authority of that username. bet(uint64_t game_id, name username, asset betting_amount) If you modify permission_level as: ...


1

If your multi_index table has multiple indices by using indexed_by, additional index will be shown like ORIGINAL_TABLE_NAME........1. The last character will use remaining last 4 bits in eosio::name. This is why additional indices can exist up to 16. (4 bits, 0 - 15 will be translated into ., 1-5, a-j) If you show the struct declarations and typedefs of ...


1

You can deploy only one contract per account. If you deploy new contract on your account, existing contract is removed, but its data saved via multi_index table are alive. You need to merge three contracts into one. Easiest way to do this is putting all methods of three contracts into one class. Second, you can use multiple contract classes in one wasm, ...


1

You can search for an iterator with given key from multi_index first. iterator found: already created item, require_auth(user) iterator not found: not created item, require_auth(admin) Permission check can be done in any step of your method. (Even you call require_auth() at the last time of your method, its failure reverts all changes made during that ...


1

Cool idea. I guess the bidding & auction system is possible, but with some limitations. Data Storage & Computation This are just normal transactions storing information who has bid when. You can use the multi_index to store that. Timing It may not be 100% fair because of the synchronization of bidding timings, regarding when a transaction/bid ...


1

There are many different ways to achieve the conversion between the Objects returned by EosSharp and MongoDb. If you only want to convert the data to a string and store it in a MongoDB, it only depends on wich part of the data you want to store. A possible simple (but CPU-consuming because of the string-conversions) solution probably looks like the ...


1

You can't access mongodb from smart contract at all. It is executed in closed and segregated context and can't communicate with external network except for internal state. Internal state here means data stored by eosio::multi_index. Once transaction is recorded, you can make a monitoring daemon to read it from block and do something for your demand like ...


1

Native tester is not available yet unless you implement intrinsics by yourself. You can find partial implementations of intrinsics from development branch named by testerXXX, (eosio.cdt/tools/tester/eosio-tester.cpp), but not recommend to use them now.


1

the answer, as pointed out by larryk85 on github https://github.com/EOSIO/eosio.cdt/issues/751 is to properly initialise the static variables. duh! class UTL { public: static name code; static symbol sym; }; name UTL::code = name{}; symbol UTL::sym = symbol{};


1

The builtin floating-point types store values as finite binary fractions. For technical specification, see Wikipedia. For a human-readable explanation of the why, a good starting point is The Floating-Point Guide. The number 8.6 is not representable as a finite binary fraction. So, the double type stores the closest possible approximation instead, which is ...


1

If your string is always a double number // Convert to double mannualy because stod throws "out of memory bound" error in EOS string in = "5.2"; std::size_t input_dot_index = in.find("."); int64_t input_digits = in.length() - input_dot_index - 1; in.erase(input_dot_index, 1); double converted = atoi(in.c_str()) / pow(10, input_digits);


1

Do same like primary key index: void mainloan::payconfirm(uint64_t loan_id) { // assume paymade_table is instantiated through contract constructor auto pridx = paymade_table.get_index<N(loanid)>(); auto itr = pridx.find( SECONDARY_KEY_WHICH_YOU_WANT_TO_FIND ); pridx.modify(itr, same_payer, [&](auto& p) { /* updater */ }); }


1

eosiolib/* headers are deprecated and will be removed in eosio.cdt v1.7.x. Use eosio/* instead. #include <eosio/system.hpp> time_point_sec current_time_point_sec() { return time_point_sec(current_time_point()); }


1

Depending on other logic implemented in the contract I'd personally choose this implementation: struct [[ eosio::table, eosio::contract("whisper") ]] posts { uint64_t key; //Primary key (ID) name account; //Account that made the post ... ... uint128_t primary_key() const { return ((uint128_t)key << 64) & account.value; } }; ...


1

I use this helper function whenever I need to reset a table (mainly during development): template<typename T> void erase_all(T& table) { auto itr = table.begin(); while(itr != table.end()) { itr = table.erase(itr); } } Usage: Let's say there is a table named file that you want to delete, simply call: erase_all(file) As mentioned by ...


1

The question asks how to create a literal. Managing to assign a number to a variable is not quite the same. If you have a true literal, an optimizing compiler will be able to fold that into the code. But if you have a variable, the compiler will be forced to load from memory on every access, because a variable might change. You can create a true literal ...


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