๐Ÿ“„What is LP Token?

To better understand AshSwap's features, you need to first know a core concept of DEXs, the LP token. What is it and what is it used for?

LP Token

The concept of LP token is simple, but itโ€™s often associated with some strange numbers that make it hard to grasp.

Here I added 100 USDC to the USDC/USDT pool and received 97.09 LPT-999601 tokens.

You donโ€™t need to know where the number 97.09 comes from. What you need to know is when you decide to become a Liquidity Provider (LP) by adding your tokens to a liquidity pool of AshSwap, you receive back some LP tokens as the representation of your proportion of the pool. LP tokens are just normal ESDT tokens and are only minted for LPs, so you can easily calculate your proportion by dividing the number of your LP tokens by the total supply of the LP tokens.

Letโ€™s continue with the above example. Thanks to the Elrond Explorer, the total supply of the token can easily be found on the token page.

My percentage is 97.07 / 29,499,914 * 100% ~ 0.00033%. This means Iโ€™m entitled to 0.00033% of all the trading fees collected in that pool.

Withdrawing Liquidity

Because liquidity pools contain multiple tokens and the ratios of the tokens are constantly changed under the marketโ€™s supply and demand as users trade with the pools, you almost certainly do not get back your original tokens but only the same percentage of the pool.

Letโ€™s say the pool originally has 1000 USDC and 1000 USDT and you own 10% (100 USDC and 100 USDT). After some time, assuming no one adds or removes liquidity, the pool now has 1100 UDSC and 900 USDT. When you withdraw, you still get 10% but the tokens are different (110 USDC and 90 USDT).

Impermanent Loss is a consequence of this behavior, and the risk is proportionally distributed to all liquidity providers. This is less significant in the context of a stable-swap like AshSwap, but you need to pay more attention when participating in unstable DEXs like the Maiar Exchange.

Transferring LP Tokens

Your LP position is solely represented by your LP tokens, and it has nothing to do with your wallet address. If you transfer the LP tokens to other people, they will have the right to withdraw your tokens from the pool. So why do this at all? Why donโ€™t we just save the value in the smart contracts?

Because this unlocks a lot of possibilities for other protocols to be built on top of DEXs. This deserves another article on its own, but the most popular use case is auto-compounding. On the Elrond Network, Arda provides this service. You can of course do it by yourself, but it takes time, calculations, and transaction fees. By putting all LP tokens together, they can optimize the compounding time using complex algorithms and save tons of transaction fees by sending only one transaction for everyone instead of each person having to send a transaction on his own.

Whatโ€™s next?

Now you have a solid understanding of how LP tokens work. Stay tuned for the next deep dive into the technical details of Yield Boost.

Last updated