Liquidity Pool 101 for dummies

AZXH...oo7w
22 Jan 2024
1K

Company shares and stock options are traded on a Centralised stock exchange like Nasdaq, Crytocurrencies are traded through Liquidity Pool (LP) in a Decentralised Finance (Defi) Exchange or called DEX that operates on a Blockchain like Solana.


How a Liquidity Pool (LP) works in DeFi?

Traditional stock market like the New York Stock Exchange allow buyers and sellers of stocks to trade in a centralised clearing hub where all the stocks are combined in a center. Trading of cryptocurrencies does not work like these traditional exchanges because the Bid/Offer prices put through market maker (MM) firm (eg Citadel) need constant changes/updates, and when these changes are performed on Blockchains a gas fee is charged, so the MM firm would go bankrupt from the costs of these gas fees on millions of these stock orders updates each day. Crytocurrencies are traded through Liquidity Pool (LP) as described below with the Liquidity Provider as the investers to loan the crypto assets into LP and receive %Trading fees for return like % of bank interest.
LP is a pair of crypto assets in a 50:50 ratio of value in USD. See diagram below for the imaginary LP of USDT : Solana for example:



 As an illustration, this LP has 3 Solana and 300 USDT, with 600USD in Total Value Locked (TVL). This LP is often connected to all DEXs to allow buyers and sellers to trade. All LPs set up on different blockchains like Solana, Ethereum... are all connected together by wormholes that allow tokens to flow freely across.

Based on the widely used "Uniswap DEX" model, the price of USDT and Solana that goes up and down are derived from the below formula and calculations:

          Quantity of USDT  x Quantity of Solana = K constant
                         In this case :-      K =    300 X 3 = 900

Let say Mary use 100 USDT to buy some Solana from this LP, the price of Solana she gets is calculated as follows with K remain constant as 900 :
          
Hence:- Quantity of Solana remaining after swap = 900 / 400 = 2.25
         
ie.  Mary gets 0.75 Solana in this swap because (3 - 2.25 = 0.75)

Therefore the price of Solana she paid = 100 / 0.75 = 133.33 USDT per Solana
 
33.33% increase from the orginal price 100 USD per Solana in the LP !

You can see when a LP’s TVL is small the prices of both tokens go up and down by large amount.

So make sure you buy small amount relative the the LP size for a good price !

When more people buy the Solana from this pool the supply and demand changes and push the price of the scarcity up or vice versa price of the abundance goes down. 
This LP has a Total Value Locked (TVL) of $600 USD in this particular pool as an illustration, but in real example LP is often very large like Solana/USDT or Bitcoin/USDT, it’s in millions or billions of USD, the price a buyer gets in these large pools do not change much.

The TVL changes when someone deposit or withdraw from the LP. When the TVL changes the Contant K also changes. Let's say another liquidity provider put in 200 USDT and 2 Solana into this pool. K becomes (300+200) x (3 + 2) = 2,500. The Price calculation for the swap will be different but less fluctuation as the LP is larger.

Mary now gets 0.8333 Solana at a price of 120 USDT per Solana because [ (5-(2500/600)) = 0.8333 ] instead of 0.75 Solana at 133.33 USDT per Solana with a smaller LP.

The Blockchain Algorithms keep track of these changes, and recalculates and updates new prices after each Buy/Sell in superfast speed for the next new buyer/seller order.

In fact, the computer program runs in the smart contracts in the blockchains, and act as the Automatic Market Maker (AMM) of Cryptocurrencies trading in the DEX in the Defi space. It is completely done without human intervention in the decentralised network with consensus mechanism, so it’s fair, secured and transparent to buyers and sellers, and superfast on the Solana Blockchain for the transactions to confirm.

You can track the order flows from hopping several DEXs’ LPs on Solscan before reaching your allocation. For example, you can swap from USDT > ETH > USDC > SOL through hopping several different DEXs to arrive your DEX you are trading with. This is all done by the current connection of all the DEXs on the Blockchain network. DEX like Jupiter looks at all the LPs of different token/coin pairs and adding them up together to allow buyers and sellers to get the best price.

What are the key risks for LP provider

1.    Impermanent loss – A risk of having other professional traders come to grab the under-price SOL in the LP and resell it at a higher price in other DEX. This can happen when there are many buyers for USDT in the LP and push down the price of Solana. However, this loss is usually in the range of 1-2%. And when the LP gets larger and larger this risk declines to smaller and smaller. This link is a good video on LP Impermanent loss. https://www.youtube.com/watch?v=_m6Mowq3Ptk&t=230s&ab_channel=WhiteboardCrypto.

2.    When both of Price of SOL and USDT goes down in denominated USD value, the value of the TVL will shrink and so is your investment.

3.    Collapse of the DEX, when you invest into a LP you are issued with an amount of LP token to your wallet address, this is like a “certificate of deposit”, you can claim back your investment with these LP tokens through withdraw action on the DEX that issue these LP tokens. Also, the SOL/USDT you deposited is put on the blockchain and you authorised the DEX to access these funds. So again, DYOR on the reputable DEX to invest.

This LP is based on Uniswap model of version 1 and version 2, V1 is for any token that swap with Ethereum, V2 is allowing more/different pairs of coins of LP other than with just Ethereum, V3 is concentrating your pair of LP on a specified price range, calculations for price after swaps remain the same.

If you want to learn the basics of Blockchain. See this link Blockchain 101 for dummies.

Get fast shipping, movies & more with Amazon Prime

Start free trial

Enjoy this blog? Subscribe to MBA ChitChat

57 Comments