2

When I create new state with https://developers.eos.io/eosio-cpp/reference#emplace I have to enter the account that has to pay the RAM. How is it prevented that I just enter any account and let it pay for the storage? Does the emplace require the authority of the payer?

0

emplace requires the authority of the payer. It will fail if that authority isn't present.

| improve this answer | |
  • how about modify, I find in the token transfer, the receiver didn't authorize it, how can we modify it's tokens – Jimmy Guo Jul 12 '18 at 7:25
  • @JimmyGuo a contract may modify any of its rows at any time – Todd Fleming Jul 13 '18 at 23:51
  • Yes, it can modify, but it can't make users to pay for the record if the user didn't authorize the action. I mean that when I transfer a token to another, his balance record was changed, but he doesn't authorize it. – Jimmy Guo Jul 14 '18 at 2:55
  • Whenever a contract modifies a row, it can choose to keep the row's payer as-is or change the row's payer. Authorization is only required if it changes the payer. – Todd Fleming Jul 15 '18 at 2:10
  • but in my research for code, only when you modified the record and the ram didn't increase that the modification could be done, if the ram is increase, it can't modify it, because you can't let the payer to reallocate new memory. – Jimmy Guo Jul 15 '18 at 6:44

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.