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?
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...
- require_auth differs from the auth check of INLINE_ACTION_SENDER but how?
- How to do an action in a contract to transfer tokens to other user accounts without adding permission in dawn4.0?
Let me know how you go.