I'm a bit confused about listing my token in decentralized exchanges such as sunswap and uniswap.
Could anyone tell me the road of listing my token?
and describe if do we need to add codes such as ISunswapV2Factory
or UniswapV2Pair
in our contracts code? and why and what is this code application?
2 Answers
If you are only creating a token, you only need to create the token code. The standard token code has nothing about such integrations - it only has the minimal functionality for the token to work by itself.
Some tokens include some fancy functionality to automatically execute some trades against Uniswap in some scenarios, but that gets complicated quite fast and is definitely not required for a token.
So, to add your token to for example Uniswap, you just need to create a default token with minimal functionality and just list it in Uniswap with some other asset, as a Uniswap pair.
No.
Your token should adhere to the ERC20 standard which allows the DEX to operate with it.
You will need the basic exchange functions:
transfer
- executed during a purchase. LP calls transfer from its tokens to the buyertransferFrom
- executed when you sell. LP calls it to get your tokens over to itself, while giving you back the paired asset you're selling for
As well as balance/authorization functions:
balanceOf
- how many tokens does an address haveallowance
andapprove
- for proxy-handling of tokens
Here is the IERC20
interface. For the easiest development route, just implement it in your token code and it will work properly.
https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol
As @lauri-peltonen noted, you can add the Uniswap interface into your contract if you need to perform some custom actions, like rebasing or adding liquidity, but for the sake of a regular token, it won't be needed.