3

For example, if Alice sends a transfer from the eosio.token contract to my smart contract, how do I listen to see if she has actually sent me a transfer from the eosio.token contract and get the data from the action?

1

Ah nevermind. There is an example in the tic-tac-toe contract https://github.com/EOSIO/eos/blob/master/contracts/tic_tac_toe/tic_tac_toe.cpp

You can use the apply method to listen to an incoming action but you must declare extern "C" beforehand.

//tic-tac-toe contract example    
extern "C" {
  void apply( uint64_t receiver, uint64_t code, uint64_t action ) {
    //logic goes in here
  }
}
| improve this answer | |
  • 1
    If you rephrase this as an actual answer with full explanation, it would probably be worthy of an upvote. – AntonChanning Jul 2 '18 at 14:55
  • Where? I don't see that contract resolving your question. – Tyrick Aug 9 '18 at 17:08

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.