0

enter image description here

enter image description here

Network: kylin testnet.

I transferred eos to this contract, but it the "deposit" function was not called. What do I miss?

3
  • CDT version: v1.6.1
    – Shane
    May 15 '19 at 4:01
  • Trying to help here: Can you specify the part "not working". Can you please edit the question 1) what is the result you are expecting to happen 2) what actually happens? May 15 '19 at 8:12
  • sorry, I added that result.
    – Shane
    May 15 '19 at 10:52
1

I believe the action wrapper is needed to map the transfer action to the deposit function, the notification by itself is not sufficient.

try adding to ln15 of header:

[[eosio::on_notify("eosio.token::transfer")]]
void deposit(name from, name to,asset quantity, string memo);
using transfer_action = action_wrapper<name("transfer"), &hello::deposit>;
3
  • Please explain your answer with a few lines. StackExchange guidelines encourages us to set posts into a context, so that others can understand your solution more easily.
    – TeeAttack42
    May 22 '19 at 10:33
  • 2
    updated, the answer to include more lines on context. I believe the action wrapper is needed to map the transfer action to the deposit function, the notification by itself is not sufficient.
    – cryptosig
    May 22 '19 at 20:56
  • where is the official documentation for how this is done?
    – ekkis
    Dec 13 '19 at 1:48
1

If you are using EOSIO_DISPATCH with ACTION keyword, then replace ACTION keyword with [[eosio::action]] void from your .hpp file and remove EOSIO_DISPATCH from your .cpp file of smart contract.

As EOSIO_DISPATCH blocks eosio::on_notify.

Also check: [[eosio::on_notify("VALID_EOSIO_ACCOUNT_NAME::VALID_EOSIO_ACTION_NAME")]] Ref: https://developers.eos.io/manuals/eosio.cdt/v1.6/guides/generator-attributes

Please closely check eosio.token contract you will get how use. https://github.com/EOSIO/eosio.contracts/tree/master/contracts/eosio.token

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.