I would like to make a contract, wich listens to the incoming transfers.

How do I make a listener contract, wich listens to incoming transfers on the account?

  • Oh i see.. I need to modify the transfer contract.
    – Efraim
    Dec 3 '19 at 21:01
  • Hi @efraim, you should write an answer and accept it, so others with a similar problem who will find this question in the future will see the solution. Ideally add some code example to show what you did.
    – Ami Heines
    Dec 5 '19 at 6:43

My solution is:

1 I modify the eosio token contract. First I put the new method wich we want to run after the transfer contract. Forexample: after_transfer (){....}

  1. After I put the these lines to the their *.hpp

[[eosio::on_notify("*::transfer")]] void after_transfer(eosio::name from, eosio::name to, eosio::asset quantity, std::string memo);

This is modify eosio token contract. I deployed to the eos account. So if somewhere use transfer method..(transfer token to account wich contain the modify transfer method) after the transfer run the second method (after_transfer())

The solution is a "eosio::on_notify".

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.