2

I am learning Eos smart contract. But there are no information except Eos wiki. In ethereum, ethers can be transferred by payable function. How can I transfer Eos in Eos smart contract?

1 Answer 1

1

Each smart contract has it's very own account so if you simply wanna transfer a token to it just transfer to it's account.

However, should you want to keep a record of who's sent the token and how many then you need to set up a listener on the contract which calls a function to add a record to a multi-index container or do whatever else it should do upon receiving a token.

Listening to this action is something I've struggled with as I believe it's not supported by the EOSIO_ABI macro in the contract and can only be done by tinkering with it, an update should resolve this and create a better developer experience.

Check out these other answers...

Let me know how you go.

4
  • Thank you for your answer. I will read articles you choose. I know basic concept of Eos transaction and action, but I couldn't find that how to transfer Eos(not token). I want to know the basic process of transfer Eos(like payable function in solidity).
    – Thunnini
    Commented Jun 8, 2018 at 3:38
  • 1
    Sorry, can you spell it out further then, there is no such thing as a 'payable' function like in Solidity. Pure transfers can be accomplished like on MeW for Ethereum, doing a transfer on EOS can be done with cleos like cleos push action eosio.token transfer '["me", "you", "1.0000 EOS, "memo"]' -p me Commented Jun 8, 2018 at 3:42
  • Very thank you for your response. But I have one more question... EOS(native coin) is also handled like token?
    – Thunnini
    Commented Jun 8, 2018 at 3:46
  • Sure is, uses the same contract. Commented Jun 8, 2018 at 6:39

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.