๐ How to crypto investor | Liquidity Pools
With each new guide, we are going deeper into cryptocurrencies' financial and technical principles. Today, we will talk about liquidity, Liquidity pools, and how to earn with them. LP it's the key to understanding how DEX works, so any investor needs to learn it.
What is liquidity and liquid pair?
Liquidity is an asset's feature that allows exchange for another asset or commodity. It also matters for crypto, as the liquidity of a token or coin shows how easy it's to buy or sell. The higher the liquidity - the easier exchange.
On trading platforms and exchanges, you can face the term "liquid pair" ("trading pair" for CEX). A liquid pair consists of a coin that you need to sell (or buy) and an asset to be exchanged for.
You need to know how liquid pairs work to understand why you have problems when trying to sell fraud IDO coins. So here we are:
On the CEX, liquid pairs are determined by the site. The exchange chooses and adds tokens to the listing and provides liquidity in a certain trading pair. It is essential to understand that CEX provides all its liquidity by itself, giving it the right to decide what token is tradable and is not.
On most DEX, liquid pairs are formed by the Liquidity Pools (LP). The pool creator sets the tokens for the liquid pair, the transaction fee, and other options.
The LP is the basis of most DEX and one of the main DeFi-lego blocks. If you know how to LP, you are ready to start at DeFi.
How Liquidity pools work
The LP is a smart contract with a reserve of coins for a liquid pair. When a user wants to sell a token A for a token B, he puts a token A into the pool and takes a token B from it.
The logical question arises - how is the exchange rate formed in the pool? Rate calculating by an Automatic Market Maker (AMM). AMM is an algorithm that calculates the actual exchange rate based on the balance of supply and demand.
The most common formula for AMM is X x Y = k. A is the First token quantity, b is the Second token quantity, and k is a constant product.
For example, we have the ETH/USDT pool. Suppose that when you create that pool (or deposit to it), the 1 ETH = 2000 USDT. The user must deposit two assets in equal dollar evaluation to provide liquidity. Let's say the pool holds a 5 ETH and 10,000 USDT. Then according to the X x Y = k, the constant product is 50,000.
The market maker must keep the stable constant product value. For example, if the DEX user buys 1 ETH, the pool will remain at 4 ETH and 12,000 USDT. The constant product is 48,000, so AMM needs to raise the exchange rate to back for the 50,000. Then 1 ETH will cost not 2000 USDT but 3125 USDT, then 4 ETH = 12,500 USDT = 50,000 constant product.
In fact, each liquidity pool is an independent market with its supply and demand balance and exchange rate. As you can see from this example, the smaller the liquidity in the pool, the greater the volatility of the liquid pair.
If the pool was not 5, but 50 ETH, the price rising when buying 1 ETH would be not 1125 USDT but only 82 USDT.
Liquidity provider
Since the DEX does not have centralized management, the LP is created decentralized by any user or by DAO, depending on how the platform is managed. You should know the two main LP classifications:
By availability - there is a private or public pool. Anyone can provide liquidity to the public pool and receive rewards based on the common rules. Access to the private pool is possible only with the creator's permission. Creator also sets the conditions for providing liquidity and exchanges.
By token number (AMM type) - pools can include 2 tokens, such as Uniswap or more, as Curve's 3pools or Bancor's OmniPool. Depending on the AMM model, the liquidity provider must provide all assets in equal stakes (as in our example above) or only one asset.
As a reward for providing liquidity, providers receive a share of the transaction fees, proportional to the value of invested capital. LP tokens confirm your pool share. You can get it when you deposit assets into the pool and must burn it when you want to withdraw liquidity.
Some sites may drop their native tokens to the liquidity providers as incentives. For example, SushiSwap gives SUSHI tokens for providers to raise liquidity.
Impermanent loss
Since each pool is a different market, the price of the asset in it may differ from the average market value. This problem is solved by arbitration in most cases, but not always.
Impermanent losses are the difference between how much your asset is worth in the LP and how much it would be worth if you just kept it in your wallet.
For example, if 1 ETH was worth 2000 USDT, and then its price increased to 3000 USDT, then hold the Ether in your wallet, you would earn 1000 USDT. But, in the LP, its price may rise only to 2500 USDT due to low demand in the pool. Then you lose 500 USDT compared to the market value.
We call these losses impermanent because traders can still balance the price via arbitration. But it is impermanent as long as your assets are in the LP, so you make the losses permanent when you withdraw your assets.