DeFi News

How Do Liquidity Pools Work?

Pinterest LinkedIn Tumblr
IMG Source: CoinMarketCap

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.

Chainlink (LINK) $ 21.49
yearn-finance (YFI) $ 31,477.00
Aave [OLD] (LEND) $ 1.94
Uniswap (UNI) $ 8.56
Synthetix Network Token (SNX) $ 14.10
UMA (UMA) $ 12.09
Compound (COMP) $ 202.01
Maker (MKR) $ 1,336.58
Wrapped NXM (WNXM) $ 44.95
0x (ZRX) $ 0.510418
Loopring (LRC) $ 0.410039
REN (REN) $ 0.660348
Kyber Network (KNC) $ 1.45
Numeraire (NMR) $ 27.36
Band Protocol (BAND) $ 8.74
Terra (LUNA) $ 0.851535
yfii-finance (YFII) $ 1,799.14
Sushi (SUSHI) $ 6.65
Balancer (BAL) $ 20.07
THORChain (RUNE) $ 2.10
Reserve Rights Token (RSR) $ 0.039235
Ampleforth (AMPL) $ 0.938297
Nest Protocol (NEST) $ 0.030469
Serum (SRM) $ 1.67
Keep Network (KEEP) $ 0.288133
Augur (REP) $ 19.21
Curve DAO Token (CRV) $ 1.93
kava (KAVA) $ 2.04
Bancor Network Token (BNT) $ 1.68
JUST (JST) $ 0.026910
Gnosis (GNO) $ 106.98
ForTube (FOR) $ 0.016219
Cream (CREAM) $ 156.05
Melon (MLN) $ 44.56
Tellor (TRB) $ 26.43
Akropolis (AKRO) $ 0.014711
IDEX (IDEX) $ 0.034433
Nectar (NEC) $ 0.109244
bZx Protocol (BZRX) $ 0.269144
AirSwap (AST) $ 0.112931
Switcheo (SWTH) $ 0.023099
Orion Protocol (ORN) $ 2.71
dForce Token (DF) $ 0.145309
Meta (MTA) $ 2.41
pNetwork (PNT) $ 0.429291