I am a DAPP Developer in Korea. I have publish my own token using eosio.token recently. I love to study eos main network system. Now I am trying to learn how swap my token with EOS. So that I was looking for the contract examples or templates swapping any EOS based token with eos or any other token. I am wodering that there are the templates or example from system contract or any other sources I can look into. Thank you.
-
I don't understand your question. What do you mean by "swapping"? What are you trying to achieve?– cmadh ♦Jul 25, 2019 at 11:52
-
For example, if I send one TEST token to DAPP, I get one EOS coin. Conversely, if I send one EOS token, I can get one TEST token. To exchange EOS coins with a token that I have made at this constant rate. Is there a contract that meets the conditions I said?– Alan KimJul 25, 2019 at 12:46
1 Answer
Tokens are simply numbers stored in tables of the smart contract user that issues them.
You could even create a new "EOS" token if you deploy the eosio.token
contract to a user.
There exists no logic to swap from one token to another; but you could write it given you had some price feed that creates a "value" for each token.
If you create a self issued token that gets listed on exchanges and has a value, you could sell it and use the proceeds to purchase EOS or another token, but that isn't really what you are asking .. that's just using a currency exchange with existing markets.
-
I would rather have them dynamically exchange using smart contracts than using the existing market. For example, if I send one TEST token to DAPP, I get one EOS coin. Conversely, if I send one EOS token, I can get one TEST token. To exchange EOS coins with a token that I have made at this constant rate. Is there a contract that meets the conditions I said?– Alan KimJul 25, 2019 at 13:01