1

I got a question about how to afford the cost of emplace action...

code in eosio.token like :

statstable.emplace( _self, [&]( auto& s ) {
       s.supply.symbol = maximum_supply.symbol;
       s.max_supply    = maximum_supply;
       s.issuer        = issuer;
    });

My question is: I know functions like emplace need RAM to save data, if the payer is [_self], do I have to keep buying the RAM for the token contract to keep it running for the transfer action?

Second, once I deployed some contract of EOS games and if I want to keep the games running, can I just set the player(from) as the first param (payer) of emplace to reduce the contract cost?

0

Q1. The emplace code you provided is from the create function. The create function is only called once you create a particular token. In issuing you are not creating any new entries in statstable, just modifying the existing entry. Therefore, you don't have to pay for it.

You can create more than one token(but with a different token symbol) with the same token contract. In that case, you have pay for creating that entry too.

Q2. Yes, you can change the ram payer to reduce operational cost.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.