I did some research but I couldn't find anything so specific. I would like users that own a specific ERC20 token to be able to use it to buy an ERC223 token generated by a contract according to specific exchange rate. The ERC20 token should then get stuck in the contract and nobody should be able to withdraw it. Basically we want to convert 1000 old ERC20 tokens into 1 ERC223 new tokens. Thanks.

  • There is no question here, just an implementation requirement. – goodvibration Feb 24 '19 at 13:55

1) A person would have to grant the new ERRC223 contract an allowance via the approve() function call of your ERC20 token.

2) The new ERC223 contract would have a function callable by the same account that granted the allowance. This function would use transferFrom() of the old ERC20 contract to transfer the balance from the tx.origin (the OG msg.sender) to itself (address(this)).

3) Within the same transaction as step #2: the new ERC223 contract would then calculate the exchange ratio and mint/transfer the appropriate about of new tokens to the account.

| improve this answer | |
  • Thanks, how do I implement this in a contract? – Zetal Feb 24 '19 at 12:58
  • These functions are part of the ERC20 standard. Any smart contract developer would be able to implement this. For a new developer, a simple Google query will go a long way to providing your answer. – Matt Swezey Feb 25 '19 at 16:03
  • Well, thanks for telling me to find it out myself. – Zetal Feb 26 '19 at 6:18
  • You gave 0 code to your question. You asked a simple question. I gave you the correct way, via text, on how to solve your problem. Querying on the key function names in my response would result in everything you need to learn about how to implement it. If you need someone to implement it for you, I suggest hiring a solidity developer. – Matt Swezey Feb 27 '19 at 7:33

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.