How do Liquidity Pools work?

Reading time:


liquidity pools

Liquidity Pools is a breakthrough concept for the DeFi ecosystem. It is a fundamental tool for the operations of decentralized exchanges (DEXs). This blog post explains how liquidity pools work, their importance for crypto operations and how DeFi protocols are using them. If you are new to DeFi, you might want to check our previous blog post introducing the concept.

Why do we need Liquidity Pools?

Liquidity Pools provide liquidity to trading pairs, enabling DEXs to offer users exchange services without relying on intermediaries. Some of the most popular DEXs adopting Liquidity Pools are Uniswap, PancakeSwap and SushiSwap.

Liquidity Pools are essential for DEXs because they introduce the concept of Automated Market Makers (AMMs). AMMs determine price adjustments of tokens and incentivize users to provide liquidity to trading pairs and earn returns. In addition, they are autonomous and eliminate the need for the order book market-making method which is used by centralized exchanges (CEXs).

AMMs ensure that there is liquidity for users to buy a specific token, without relying on another party to execute the trade. The main aspect of liquidity pools is that through AMMs they eliminate the need to rely on external market makers to provide liquidity for trading pairs. This is not the case in CEXs.

The problem with CEXs

Users in CEXs facilitate trading via the order book method, similarly to traditional stock exchanges. An order book is a list of buy and sell orders and is categorized by price level. In an order book model, buyers and sellers, respectively place their orders on the price they wish to buy (bid) and sell (offer) their tokens.

Visually, the top of the order book indicates the highest bid and lowest ask prices for a token, thus pointing to the current price level. Buyers and sellers have to agree on a fair price in order to execute a trade. Furthermore, a buyer may want to buy a bigger amount of coins than what the “best” seller offers. For example a buyer wishing to buy 1 Ether, may have to buy 0.8 Ether at the price of $5,000 (best seller) and 0.2 Bitcoin at the price of $5,000.02.

Buyers and sellers tend to update their orders in order to obtain the best possible buy and sell opportunities. This does not seem an ideal feature for DeFi as it involves order delays, updates and cancellations, therefore additional network fees for each action.

How do Liquidity Pools work?

Liquidity Pools provide liquidity for trading pairs by holding liquidity for two tokens e.g. ETH and SWAP. For example, users can add liquidity on the SWAP/ETH liquidity pool on Uniswap and earn returns according to their portion of the pool.

When liquidity providers provide liquidity to a pool, they receive Liquidity Pool tokens proportionately to the amount of liquidity they have provided to the pool. These Liquidity Pool tokens can be used to withdraw their earnings from providing liquidity. Trades usually execute with a 0.3% fee for DEX users. Liquidity providers earn a portion of this 0.3% fee, according to how much of the liquidity they have provided to the pool. For instance, Bob provided 1% of the liquidity on a trading pair, and the total trading fees of the pool amount to $1,000. Bob will earn a $10 fee as a Liquidity Pool token holder.

In new liquidity pools, the first liquidity provider determines the starting price of the tokens. The liquidity providers supply the pool with an equal value of both tokens. For example $100,000 worth of SWAP and $100,000 worth of ETH. If liquidity providers do not supply an equal value of both tokens, the price of tokens in the pool will differ from other markets which will create arbitrage opportunities for other users. Consequently, if external users exploit this opportunity the liquidity providers experience a loss. Losses may be occured for liquidity providers due to impermanent loss, which will be explained in the next blog post.

How do AMMs determine token prices?

Most popular DEXs use the AMM algorithm Constant Product Formula to determine token prices. In simple terms, the ratio of the tokens in the pool determine their prices. The Constant Product Formula is very simple and can be outlined as follows in the example of SWAP/ETH pool on Uniswap:

x * y = k

x is the amount of SWAP tokens in the liquidity pool

y is the amount of ETH tokens in the liquidity pool

k is a fixed constant

K is constant assuming that there are no transaction fees. Actually trades increase k proportionally to the transaction fee and the amount traded.

For example a SWAP/ETH liquidity pool is initially supplied with 200,000 SWAP (x) and 100 ETH (y). The constant product (k) is equal to 20,000,000. 1 ETH is worth 2,000 SWAP.

When a trader swaps SWAP for 1 ETH, the amount of ETH reduces and the amount of SWAP increases. In order to maintain a constant product of 20,000,000 the price quotation for SWAP will be 2,020.20. The liquidity pool will now consist of 202,020.20 SWAP (x) and 99 ETH (y). The constant product (x) is again equal to 20,000,000. 1 ETH is now worth 2,020.20 SWAP. ETH price has increased and SWAP price has decreased.

The smaller the pool is, the bigger the price impact of each trade and vice versa. Therefore, large trading pools offer a smoother experience for traders.

This mechanism ensures that the pool provides liquidity for large trades in volume. Other common AMM algorithms include the Constant Sum Formula (suitable for tokens with same price), Constant Mean Formula (allows for more than two assets in a pool) and Stableswap Invariant (suitable for stablecoins).

Additionally, several DeFi protocols are offering liquidity providers with extra governance tokens for certain pools i.e. liquidity mining.




Share this article:

Keep Reading:

The Main Types of Cryptocurrency
The Main Types of Cryptocurrency
Bitcoin was the first cryptocurrency to be invented as a peer-to-peer version of electronic cash. The Bitcoin whitepaper came out 13 years ago and through the years facilitated a major...
Understanding Binance, Smart Chain and BNB
Understanding Binance, Smart Chain and BNB
Binance Smart Chain has grown fast since its launch, providing an alternative to Ethereum. Learn about BSC and its native cryptocurrency, BNB, in this article.
PancakeSwap: BSC’s DeFi crown jewel
PancakeSwap: BSC’s DeFi crown jewel
PancakeSwap is BSC most prominent DeFi platform. Many use it to trade their coins but also to invest and earn cryptocurrency. Learn all about it here.

Stay up to date with our news and updates