2

I'm writing a function in my contract that is supposed to run only if I receive a transfer notification from "eosio.token". The way I handle eosio.token transfer notification is similar to this (but not exactly, I changed the condition so that my function will be called ONLY when the "code" is "eosio.token"). My function is a public function but it is not defined in the ABI file.

My question is: Is it safe to assume a user has no way to call this function except through pushing a transfer action with "eosio.token"?

1

Contracts can't call each others' functions. Instead, they send actions to each other. All actions go through the apply function; it determines what's accessible.

| improve this answer | |
  • Thank you very much, that makes sense! I think I can achieve what I want by making sure my function won't be called except when "code" is "eosio.token" and "action" is "transfer" within the "apply" function. – mochunhei Jul 1 '18 at 12:24
  • Yes. That works. – Todd Fleming Jul 1 '18 at 12:26

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.