5

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 ...


5

is_feature_activated is new intrinsic which is introduced in EOSIO v1.8.x. It would be activated by hard fork, but not yet supported. Use release/1.6.x branch now.


4

Using the EOSIO_DISPATCH macros disables the automatic inclusion of actions and on_notifys, and assumes that you will deal with them manually. To fix this, you have to remove the EOSIO_DISPATCH macro from your header file. An additional note, as of eosio.cdt 1.6 there is a bug when using on_notify with a wildcard for the contract name, this can be fixed ...


4

You need to access the accounts table of the appropriate token contract, in the scope of the token that you want to check the balance for: struct accounts { eosio::asset balance; uint64_t primary_key() const {return balance.symbol.code().raw();} }; typedef eosio::multi_index< eosio::name("accounts"), accounts > accounts_table; accounts_table tmp(...


3

I'm told this will let you continue with the newest versions: https://github.com/EOSIO/eos/issues/7180


3

It means whomever paid for the RAM originally is still going to be paying for the RAM in the table after this modification. If modification of data consumes more RAM compared to original usage, setting same_payer requires authorization of original ram payer. (Or, you can modify data without original payer's authorization, if ram usage is kept same or ...


2

If you forgot that, checkout your history setabi action from block explorer, e.g. eosq.app, and you will get the binanry abi. You can either parse the abi binary to readable json, or just construct the setabi transaction and push it to the mainnet, then use command cleos get abi to see your abi.


2

Here's an updated example using EOSIO CDT 1.6 code syntax checksum256 get_trx_id() { size_t size = transaction_size(); char buf[size]; size_t read = read_transaction( buf, size ); check( size == read, "read_transaction failed"); return sha256( buf, read ); } Afterwards you can include get_trx_id method into other parts of your smart ...


2

You need to include eosio.hpp before the other includes. #include <eosio/eosio.hpp> Sidenote: this actually seems to be a problem with cdt 1.6.1 and will hopefully be fixed with next releases Issue#532


2

You have multiple questions in this post, in the future you should try to have a more focused question. ".front()" is a vector function. From the documentation: std::vector::front() Returns a reference to the first element in the vector. Now, I'll assume you weren't actually asking about front(), and instead about the purpose of the merkle() function ...


2

It is possible: Set up a new smart contract environment using eosio-init: eosio-init -project=mycontract -path=. Create all of your .cpp and .hpp files as appropriate In the ./src folder, edit the CMakeLists.txt file by adding all of the .cpp files to the add_contract command, making sure that the file containing your contract class is the last file in ...


2

This can be done by deferred transaction. It's very normal use case, for example, unstaking EOS from CPU and NET bandwidth triggers refund action which is executed in 72 hours. In your case, add the action which handles tallying and adjusting balances and push it with time delay (transaction contains field named by delay_sec) so as to execute transaction ...


2

There's no provided is_proxy method, but proxy information is stored in multi_index in eosio account, you can query that from your contract. The next code block is an example of is_proxy implementation. /** * @file proxy.hpp */ #pragma once #include <eosio/eosio.hpp> #include <eosio/asset.hpp> namespace eosio { constexpr name ...


2

The default implementation of eosio.token doesn't support burn you describe. Add next code block to your token contract. void token::burn( const asset& quantity, const string& memo ) { auto sym = quantity.symbol; check( sym.is_valid(), "invalid symbol name" ); check( memo.size() <= 256, "memo has more than 256 bytes" ); stats ...


2

"requestLoan" isn't a valid name for an EOSIO table; it only supports lower-case names using alpha characters. https://developers.eos.io/eosio-cpp/docs/naming-conventions#section-table-names-structs-functions-classes


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.


1

You can keep track of events by simply calling actions. An example of an action is a transfer, but you can make arbitrary actions using a smart contract. In this way you can have a very modular way to keep track of the events on chain. An example way you could do this is as follows (in a smart contract): ACTION zerotransfer(std::string const & ...


1

If you remove line 93 from eosio.token.cpp check( quantity.amount > 0, "must transfer positive quantity" ); you will be able to send zero amount transfers. But to be honest, that doesn't sound like a good and smart idea. If you want to use EOSIO as database without the need to execute logic that depends on the state of the blockchain that's ...


1

Check who receives a transfer when notifying a contract If you have code which is activated upon receipt of a notification. For example: [[eosio::on_notify("eosio.token::transfer")]] void transfer(eosio::name const & from, eosio::name const & to, eosio::asset const & quantity, std::string const & memo); Then you should check that the to ...


1

Have you tried to replace the from - field with your accounts/contracts name? If you use _self this should be possible. Checkout this answer from @Jeff Zheng. If you merge both codes and update macros you get something like this (please correct the code if needed, I didn't compile it): void Mycontract::yourcontract_action(account_name to, ...


1

This error message is caused because you are trying to transfer a token that you do not own and have never owned. You have no balance, which is not the same as having a balance of zero. Usually you would get this error if you make a mistake where you think you have tried to transfer a token, but you have accidentally transferred a token that doesn't exist. ...


1

EOSIO organizes data in the fashion described in the graphic below. The scope usually refers to the account in relation to which the data is stored. So eosio.token stores each account's token balance in an accounts table. But instead of a single huge accounts table, each user's account is kept in a small table scoped to that user. Shout out to the ...


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 ...


1

I did a fair bit of experimenting and I found a way where inhering within the contract class (sort of) works. Although it doesn't allow for the actions from one contract to be used in another, it does allow the internal functionality. Below is an example of inheritance used within a smart contract: inherited.hpp #ifndef INHERITED #define INHERITED #...


1

If you are looking for a solution to run a transaction in a later time after pushing the transaction, then deferred transaction is what you are looking for


1

Have you done a proper installation of the CDT like in this link https://developers.eos.io/eosio-home/docs/installing-the-contract-development-toolkit ? Maybe you dont have put the read write permission, try sudo chmod 755 /usr/opt/eosio.cdt/1.6.1/bin or if you use a previous version: sudo chmod 755 /usr/local/eosio.cdt/bin/eosio-cpp


1

Okay, I have find the solution, it was a classic header include problems, so you just have to add -I. at the end like eosio-cpp -o cardgame.wasm cardgame.cpp -abigen -I. more information about the issue here: https://github.com/EOSIO/eosio.cdt/issues/489


1

To use the secondary index, you need to use get_index(). voting::identity_index identities(_self, _self.value); auto idx = identities.get_index<"by_hash"_n>(); auto itr = idx.find(out); eosio_assert(itr == identities.end(), "User already registered to vote!");


1

Everytime you update the ABI file, a record is stored on chain. The action is eosio::setabi. Therefore it would be possible to say which version of the ABI file was current on the blockchain at the time of a transaction being signed.


1

Is this CPU-billing-scheme still in use? To the best of my knowledge, yes Points 2. and 3. My understanding of CPU billing works is as follows: A BP receives your transaction, starts a timer, processes it as fast as they can, stops a timer. The time they record is the CPU billing time that you get charged. Therefore, the number of wasm instructions ...


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