Things I wish I knew before using DEX-es and trading tokens
by Delbypoc
Note: Those views are solely my own, they may or may not be accurate (same goes for the information/examples provided).
I’m writing this article in response to some event that happened to someone while trying to swap some BNB for MAN tokens in PancakeSwap (possibly high slippage caused to buy tokens at a price 20x higher than the other markets rate).
When using Decentralized Exchanges like PancakeSwap (or any kind of Uniswap clones) you should check out a few things before trying to swap for the token you want or thinking about providing liquidity to a pair:
1.Slippage
Slippage is used to calculate the minimum amount of a specific token we must receive for the transaction to go through.
When we trade a token for another token (in a normal situation), this function of the contract can get called:
As you can see, `amountIn` is the amount of tokens that go in (send) and `amountOutMin` is the minimum amount of tokens that will go out (receive), `to` is the address that will receive the tokens.
The transaction will fail if it did not meet the requirements for the transaction to go through (the amount of tokens that you would receive are lower than the amountOutMin value).
2. Same name/ticker Tokens
Make sure that the token address for the token you want to swap to is correct (legit and comes from the official team), there is no restriction for tokens with the same name/ticker.
3. Careful about non-tradable/scam tokens.
If you manage to swap for some tokens and cannot swap back, the contract may have some functions disabled (or has been made specifically so you won’t be able to swap them back normally, in some cases it is possible if you use another contract). You can usually prevent this by researching the project and verifying a few times if the token contract is legit and not some scam attempt (with the same name/ticker as the official project)
4. Check liquidity value
Make sure the liquidity is adequate for the value you want to trade and adjust your slippage accordingly
5. Impermanent loss
When you provide liquidity to a trading pair, impermanent loss usually takes place (and most of the time becomes a permanent loss).
Uniswap V2 (also PancakeSwap) uses the constant product formula: x*y = k , x and y are the reserves and k is the product
Let’s say you provide liquidity for MAN/BNB pair and you receive no tokens for it (CAKE, UNI, etc… to compensate for it) and we have the following prices when we put our tokens in to provide liquidity:
1 MAN token = 0.1 $
1 BNB token = 400 $
If 1 MAN token were to become 1$ and 1 BNB token 500$, we would have an impermanent loss of more ~37.5%, meaning our combined value of the tokens we will get out is less with ~37.5% than what we would have if we just kept our tokens, without providing liquidity.
If 1 MAN token were to become 0.01$ and 1 BNB token 500$, we would have an impermanent loss of more ~47.6%.
Higher the difference, higher the impermanent loss, providing liquidity on new farms with new tokens is usually a good way to get completely rekt (if you get in at the start of it when prices are usually very high and they have a high inflation rate):
1 SomeToken = 10$
1 BNB = 400$
If you provide liquidity on the SomeToken/BNB pair and the price goes like this:
1 SomeToken = 0.01$
1 BNB = 500$
The impermanent loss will be around 94.35%! (considering the situation when the tokens farmed + trading fees received will not be that valuable, you will not be able to recover the loss, there are surely cases when it can be profitable)
You can check out more details on Uniswap V2 on their official website:
Last updated