Network: kylin testnet.
I transferred eos to this contract, but it the "deposit" function was not called. What do I miss?
Network: kylin testnet.
I transferred eos to this contract, but it the "deposit" function was not called. What do I miss?
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>;
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