Assuming I want to accept different (let's say 3 or 4) tokens on exchange one specific token (MyToken). Let's call this X transfer.

I'm thinking to write ERC223 contract which will accept different tokens and identify X transfer by data parameter. After that make a call to MyToken (ERC20 or ERC223) contract passing received address, amount, predefined rate and give MyToken on exchange.

Is this complication or I can just allow users to buy MyToken with other ERC20 token instead of Ether?

  • I did this with ERC20. Basically something like decentralized exchange does. Function deposit() accepts: 1) any token identified by Token address. 2) Amount of tokens; At the end it gives back to msg.sender other X amount of Tokens according to predefined rate, which only owner can change. – Gio Aug 10 '19 at 6:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.