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.
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 (
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.