I did quite a lot of research to find something like this with no success.
I would like to create a smart contract that allows any token to be backed by ETH. The user can buy the token directly by sending ETH and a 1% fee goes to a third address. Anytime, he can send back the token and receive the ETH, again the fee is involved in this transaction too.
It should be possible to modify the list of tokens accepted.
The exchange rate ETH/Token for each accepted token can be modified too.
[Ethereum] Smart contract to buy/sell ETH/ERCToken for backed token and fee on each transaction
contract-developmentfeestokens
Best Answer
What you probably need is to have a buy and sell functions. A sample could be like:
Similarly, you can use sell function.
To support multiple tokens you just need to have token balance in your contract. That's all.