Liquidity pools are pools of tokens that are locked in a smart contract. Used to facilitate trading by providing liquidity and are extensively used by some of the decentralized exchanges. Can be used to for trading, yield farming/ liquidity miningÂ
-
- In its basic form, a single liquidity pool holds 2 tokens and each pool creates a new market for that particular pair of tokensÂ
- When a new pool is created, the first liquidity provider is the one that sets the initial price of the assets in the pool. The liquidity provider is incentivised to supply an equal value of both tokens to the poolÂ
- When liquidity is supplied to a pool, the liquidity provider (LP) receives special tokens called LP tokens in proportion to how much liquidity they supplied to the poolÂ
- When a trade is facilitated by the pool, a 0.3% fee is proportionally distributed among all the LP token holdersÂ
- If the liquidity provider wants to get their underlying liquidity back, plus any accrued fees, then they must burn their LP tokensÂ
- Each token swap that a liquidity pool facilitates results in a price adjustment according to a deterministic pricing algorithm.Â
- This mechanism is also called an automated market maker (AMM)Â
-
-
- X * Y = KÂ
-
- Token x quantity * token y quantity = constant K
- This is called a constant product market maker algorithm  that makes sure the product of the quantities of the 2 supplied tokens always remains the sameÂ
- As a result, the pool can always provide liquidity no matter how large a trade is because the algorithm asymptotically increases the price of the token as the desired quantity increasesÂ
-
The ratio of tokens in the pool dictates the prices
- Ex: if someone buys ETH from a DAI/ETH pool, they reduce the supply of ETH and add the supply of DAI which results in an increase in the price of ETH, and a decrease in the price of DAI
- How much the price moves depends on the size of the trade, in proportion to the size of the pool (ie: bigger the pool is vs the trade, less price movement)Â
Concept of liquidity pools and automated market making are very powerful as you no longer need a centralized order book and market makers anymoreÂ
- On pools with significant liquidity, tokens in the pool closely track those of the wider market due to arbitragers.