0

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?

2
  • Oh i see.. I need to modify the transfer contract.
    – Efraim
    Commented Dec 3, 2019 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
    Commented Dec 5, 2019 at 6:43

1 Answer 1

0

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 and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.