0

When an external account transfers tokens to my account (which has a contract with an "on_notify" action for incoming transfers), is there any way I can get the name of the contract that they used to initiate the transfer?

In a normal EOS transfer, incoming EOS would be transferred via the eosio.token contract and the transfer action. However, let's say I have a custom token (e.g. AOS) with it's own contract/transfer action copied from eosio.token but is using a contract named "aostoken". Is there any way (from the receiving smart contract) that I can find out the contract name (aostoken) that was used to initiate the transfer?

Example: cleos push action eosio.token transfer '[ "fromaccount", "toaccount", "1.0000 EOS", "memo" ]'

Alternate push action cleos push action aostoken transfer '[ "fromaccount", "toaccount", "1.0000 AOS", "memo" ]'

If I have an "on_notify" action on my smart contract that's connected to the "toaccount", is there any ways to access the aostoken contract name from the transfer action?

1

You can use get_first_receiver() to get the name of the contract from where the notification comes.

| improve this answer | |

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.