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?
emplace
requires the authority of the payer. It will fail if that authority isn't present.
-
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
-
-
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