Decentralized finance is a revolutionary paradigm out of which new concepts, ideas and models are emerging that are not always easy to understand. One of these, Liquidity Pools, are becoming widely used instruments. An often seen term is Liquidity Pool, usually abbreviated with LP. Liquidity pools represent the backbone of important protocols such as Uniswap or Compound.
But what is a liquidity pool, and more importantly, what is it used for?
What is a liquidity pool?
Liquidity pools (or liquidity reserves) are reserves of tokens maintained in a smart contract. The liquidity pool tool is used in various categories of DeFi projects, such as decentralized exchanges or lending protocols.
Liquidity pools involve two types of actors in decentralized finance:
- Liquidity Providers
- Liquidity Users
On the one hand, liquidity providers deposit their tokens in the liquidity pool in exchange for a reward (fees, interest, etc.). On the other hand, there are users who benefit from this liquidity. They access it to perform various actions, such as trading or lending.
Before understanding more deeply how liquidity pools work, we should first address the reason for their existence. What problem do they solve?
What is the purpose of a liquidity pool?
As mentioned earlier, liquidity pools are widely found within the DeFi industry. They are used in a broad range of protocols, some of which have completely different functions. For example, they are present in decentralized exchange protocols (DEX) such as Uniswap or Balancer, as well as in lending protocols such as Compound or Aave.
Although the protocols are different, liquidity pools meet the same need: to ensure the presence of liquidity in the protocol at all times.
Liquidity pools in decentralized exchanges
The use case in decentralized exchanges seems the most favourable for understanding the usefulness of liquidity pools. You are probably familiar with services such as Coinbase or Binance. These trading platforms operate through a mechanism called an order book.
In this model, buyers and sellers come together to place their respective orders. For the trade to be successful, the price set by the buyer must match the price set by the seller. To facilitate and smooth the exchange activity, actors called market makers come into play.
These are individuals, professionals or companies, who provide their liquidity to ensure that each order is completed. They earn from the spread (the difference between the selling and buying price) on a given market. It is these market makers that ensure the liquidity and usability of an exchange.
This mechanism is extremely complicated to implement in a decentralized manner. Market maker activity requires the permanent entry or withdrawal of sell or buy orders. The problem is that current blockchains perform poorly in terms of operations which can be carried out in a short period of time.
In other words, they suffer from poor performance, rendering order books very impractical.
Furthermore, unlike Binance or Coinbase, every order in an order book on the blockchain, whether entered or revoked, must deal with the cost of gas, be it completed or not.
At this rate, a market maker on the blockchain could have greater losses from gas costs than potential profits from its activity.
From these limitations comes the need to find a new solution, to enable decentralized exchanges to take place effectively and efficiently.
This involves the use of liquidity pools and automated market makers, also known by the abbreviation AMM.
How do liquidity pools work?
The operation of liquidity pools is relatively simple.
Liquidity providers make their tokens available to the protocol in exchange for a reward. Subsequently, anyone can use those cryptocurrencies depending on the mechanics of the protocol.
Let’s look at the case of Uniswap.
Since this is the most popular DEX in the DeFi space, we will analyze how Uniswap’s liquidity pools work.
On Uniswap, liquidity providers deposit a pair of assets, for example the DAI/ETH pair. A 50/50 ratio is set by the protocol, so when a user adds 1 ETH to this pair, they must necessarily provide the corresponding value in DAI.
In order to ensure that the protocol has permanent liquidity, Uniswap uses the automated market maker formula.
It means that during an exchange, the amount paid depends on the ratio between the two tokens in the pool (in our case DAI/ETH).
From this, it follows that the higher the order placed in relation to the size of the pool, the worse the exchange ratio will be as the ratio moves along the curve.
This phenomenon is called slippage.
Other protocols may use different formulas.
Balancer, for example, allows the creation of liquidity pools with ratios other than the classic 50/50. Even lending protocols use liquidity pools that work in a relatively similar way.