See More

DeFi Liquidity Pools: How They Work and What You Need To Know

14 mins
Updated by May Woods
Join our Trading Community on Telegram

Liquidity pools play a major role in how decentralized exchanges (DEX) function. But what exactly are they, and how do they work? Learning how they operate could mean the difference between a good and a bad day in crypto — here’s what to know.

What is a liquidity pool?

A liquidity pool is a collection of funds locked in a smart contract. It provides liquidity for trading between different cryptocurrency tokens without the need for traditional market makers.

The liquidity pool concept is closely associated with Automated Market Makers (AMMs). An AMM is a type of decentralized exchange (DEX) protocol. These protocols rely on mathematical formulae to price assets instead of using a traditional order book (like centralized exchanges or CEXs).

In essence, liquidity pools are at the nexus of AMMs. They provide the capital that allows the AMMs to facilitate trades between different tokens without needing traditional buy-and-sell orders. Unlike traditional markets, the AMM model enables 24/7 trading.

Why are liquidity pools important in DeFi

Understanding the “liquidity” in liquidity pools is an essential part of understanding why liquidity pools are important in DeFi. Liquidity is the ease with which an asset or security is converted into cash without significantly affecting its price.

High liquidity indicates that an asset is bought or sold quickly and with minimal price movement. Conversely, low liquidity means that the asset is not easily sold or bought without a substantial change in price.

liquidity pools liquidity by asset type
Liquidity by asset: ncua.gov

For example, fixed assets (e.g., real estate) are highly illiquid. If you invest in real estate, you cannot buy or sell a property as easily as you could a stock.

If you needed cash at short notice, you wouldn’t be able to sell one of your properties to meet that immediate demand. You would have to find a buyer, fill out mountains of paperwork, and complete many other activities that take time due to regulations and other factors.

On the other hand, buying or selling a stock or security is easier because there are many buyers and sellers. As a result, securities as an asset class are highly liquid. Without liquidity pools, cryptocurrency traders would have a difficult time buying and selling.

Why do liquidity pools exist?

Liquidity pools address liquidity, volatility, supply and demand, and pricing challenges in decentralized environments. When an asset has low liquidity, the market for that asset typically has high slippage.

The difference between the expected price and the actual price at which a trade executes is slippage. For instance, if you have a cryptocurrency with a low market capitalization and few buyers and sellers, a large buy or sell order could create a huge impact.

If there is a large buy order, the price could skyrocket due to increasing demand. When someone else tries to execute another large buy order, but there is not enough crypto to fill their order at the current price, they will buy the next available tokens at a higher price.

This is because prices are set in a liquidity pool by the balance between supply and demand. It’s important to note that liquidity pools provide liquidity but do not necessarily solve the slippage or volatility problem.

Automated Market Makers using liquidity pools provide constant liquidity, as trades always have a counterparty (the pool itself). This model can offer lower slippage in markets with stable and high liquidity but may suffer from higher slippage during large trades.

How do liquidity pools work?

In a liquidity pool, users called liquidity providers (LP) add an equal value of two tokens (or more in some cases) to a pool. Traders can then use them to swap between these tokens.

This mechanism allows for automatic and peer-to-peer trading at prices set by a mathematical formula (e.g., the constant product formula in Uniswap).

To understand how liquidity pools work, you must understand the CFMM (also known as the constant product market maker or CPMM for short). Particularly the constant product function in a liquidity pool.

The Geometry of Constant Function Market Makers by Angeris, G., Chitra et al: Arvix

AMMs, specifically CFMMs, use specific mathematical formulas to determine the pricing of assets within their systems. Notably, exchanges such as Uniswap, SushiSwap, and Curve often adhere to the constant product formula as their primary pricing mechanism.

This formula, notably used by Uniswap and its derivatives, is X * Y = K. “X” is the amount of one type of asset in the pool, while “Y” denotes the amount of the alternate asset. “K” remains a constant, representing the product of “X” and “Y,” and only changes when liquidity is added or removed.

The algorithm raises a token’s price to compensate for the drop in token quantity as transactions take place. Conversely, as an asset’s quantity rises, the AMM will lower its price to make up for it. As a result, the formula accordingly adjusts the token’s price to maintain equilibrium.

liquidity pools constant function
Constant product formula visualized: Medium.com

It is important to point out that there are several functions used by different decentralized exchanges to price the assets held in liquidity pools. There are also liquidity pools that use constant sum or mean functions. Curve Finance uses both a constant product and constant sum function, while Balancer uses a constant mean function. Although the most popular is the constant product — perhaps due to the many Uniswap clones.

Types of liquidity pools

Although the DEX liquidity pool is the most known type, there are liquidity pools for many other financial activities.

Borrowing and Lending Pools

Platforms like Aave and Compound use liquidity pools to facilitate borrowing and lending activities. Users supply assets to these pools to earn interest, and these supplied assets are made available for others to borrow. Interest rates are typically determined algorithmically based on the current supply and demand for the underlying assets.

Yield Farming Pools

These liquidity pools are designed to maximize the returns on staked or lent assets through various strategies. Participants might move their assets between different pools (across various protocols) to chase higher yields, often earning additional rewards in the form of governance tokens or other incentives beyond the standard transaction fees or interest rates.

Insurance Pools

Platforms like Nexus Mutual use liquidity pools to provide decentralized insurance services. Users can supply assets to these pools and receive payment in the form of premiums from those purchasing insurance coverage. The funds in the pool are used to pay out claims as needed.

Pros and cons of liquidity pools

ProsCons
Fast order executionSlippage
Liquidity provisionImpermanent loss
On-chain price discoveryVolatility

Pros

  1. Fast order execution: Liquidity pools enable immediate trade execution without the need for a buyer and a seller to match directly. This is because the liquidity is always available from the pool. This ensures that trades complete quickly, which is beneficial in fast-moving markets.
  2. Liquidity provision: By pooling assets from many LPs, AMMs ensure that there is sufficient liquidity available for trading. This reduces the spread (the difference between buy and sell prices) and makes it easier for users to enter and exit positions at as close to the fair market value as possible.
  3. On-chain price discovery: Liquidity pools facilitate price discovery directly on the blockchain. The price of assets in a pool is determined algorithmically. They are based on the ratio of assets in the pool and the trades that occur. This effectively reflects current market conditions without the need for external price feeds.

Cons

  1. Slippage: In liquidity pools, large orders compared to the total pool size can lead to significant price changes between the time a transaction initiates and executes. This discrepancy can lead to traders receiving less than expected when making large trades in a pool with limited liquidity.
  2. Volatility: High volatility can exacerbate the risks of impermanent loss and slippage in liquidity pools. Prices within AMMs are dependent on the ratio of assets in the pool. As a result, sudden market movements can lead to unfavorable conditions for LPs and traders.
  3. Impermanent loss: This is the temporary loss LPs incur when the price of assets in a pool changes. If the prices of the pooled assets diverge significantly from the time you deposited them, the value of the provider’s share of the pool could be less, in comparative terms, than if they had just held the assets outside the pool. This loss is “impermanent” because it’s possible to reverse it if the prices return to their original levels.

How do LPs use liquidity pools?

Liquidity pools are open protocols. As stated previously, they allow anyone to trade in a peer-to-peer fashion by providing liquidity. This is because LPs are incentivized to deposit their idle cryptocurrency into liquidity pools by earning profits on trading fees.

Different DEXs may charge a fixed trading fee on all orders distributed to the LPs. For example, Uniswap has a 0.3% trading fee, while PancakeSwap has a 0.25% trading fee. Of PacakeSwap’s 0.25% fee, 0.17% is distributed to LPs.

However, using liquidity pools is not without risks. The greatest risks you will encounter in most areas of crypto are smart contract risks. Liquidity pools are no exception, as seen in the series of Vyper exploits.

LPs must also keep in mind loss versus rebalancing (LVR). LVR is a concept closely related to impermanent loss. In a nutshell, it is the amount of profit an LP loses out on due to adverse selection, a situation where buyers and sellers have different information. In volatile markets, this can lead to significant discrepancies.

Liquidity pools vs order books

AMMs were developed to create decentralized exchanges for digital assets, utilizing a specific function that sets predefined prices based on the quantities of multiple assets. In contrast to traditional exchanges that operate with order books, traders engage with a collective pool of assets instead of individual counterparts.

With an order book model, trades execute when matched with other orders. In essence:

  1. A trader generates a buy order.
  2. It matches with a sell order.
  3. The order executes at a specified price.

In conventional order book markets, assets typically trade against a currency. On the other hand, liquidity pool assets are not valued in currency but against each other. In a crypto order book model, the currency that the asset trades against is also a cryptocurrency.

For liquidity pools, the immediate pricing of each asset is determined by the ratio between the two assets involved rather than a currency. However, the model does have some similarities to the order book.

With limit orders, the trades only execute when the price for a buy order matches a sell order. This can lead to longer wait times before the transaction completes. On the contrary, liquidity pools allow for a more immediate execution, as described earlier.

Liquidity pool tokens

When you become an LP in a liquidity pool, you receive a proportional amount of fees for supplying liquidity for trades, according to your share in the pool.

As a result, you will need a way to take profit without immediately removing your tokens (the base and quote tokens) from the pool, as some pools may have lock-up periods.

In comes the liquidity provider (LP) or pool token, not to be confused with liquid staking tokens. To be clear, there are usually three types of tokens in a DEX model with a liquidity pool. The base token is the one that is traded or swapped for another token, the quote token.

LP tokens represent claims on the amount of profits or interest an LP is entitled to. It is not a part of the pool involved with buy and sell transactions.

How it works

When you become an LP on a DEX, here’s what typically happens:

  1. You select a specific liquidity pool (e.g., ETH/DAI) and deposit equal values of both assets into the pool according to the current price ratio.
  2. Once you deposit your crypto, the smart contract mints LP tokens that correspond to your share of the pool. The number of tokens you receive represents your proportionate share of liquidity in the pool.
  3. As trades occur within that pool, a small fee (e.g., 0.3% on Uniswap V2) is taken from each trade and added to the pool. This increases the total value of assets in the pool.
  4. If you decide to withdraw your liquidity, you can redeem your LP tokens. The amount of assets you receive back will include a portion of the trading fees, proportional to your share of the pool.

LP tokens have become a coveted type of token unto themselves. As a result, you will notice liquidity pools for LP tokens as well. Many LP tokens on the Ethereum blockchain are ERC-20s. This allows for ease of use when programming pools and DEXs.

What can you do with LP tokens?

The interesting thing about the high demand for LP tokens is that you can take them to other DeFi platforms. You can stake, loan, or engage in yield farming.

Yield farming is when you deposit tokens into a liquidity pool (be it for staking, liquid staking, lending, or crypto trading) and take the LP tokens to another platform and deposit them to earn profit. By loaning out or staking your LP tokens on the other platform, you can maximize the profits that you earn at once.

Note that the success of yield farming is typically dependent on market conditions and the performance of the underlying assets. Making informed decisions requires taking these aspects into account, as well as platform-specific risks and rewards.

What are the best practices for using liquidity pools?

The best practices for using liquidity pools depend on what side of the pool that you are on. If you are buying or selling cryptocurrency from a liquidity pool, you can use a DEX aggregator like 1Inch or Matcha to get the best rate across many pools.

Another thing you should keep in mind is smart contract risk and front running. Smart contract risk is less of a problem on the buyer and seller side, as many DApps are open source. However, users should still exercise caution. As for front running, and generally any MEV attacks, you can change the RPC provider in your wallet for MEV protection.

On the other hand, if you are an LP, you may have to do a little more research. It is important to clearly understand the risks involved. Liquidity pools using stablecoins typically have lower volatility and lower risks of impermanent loss. Additionally, make sure that the fees you earn cover impermanent loss, too.

Some AMMs offer additional rewards for providing liquidity, such as liquidity mining or yield farming programs. These can offer additional incentives on top of transaction fees. You should also keep in mind that these models pay via the inflation of new tokens. This model is not profitable in every scenario.

Pool size is also a significant factor. Larger and more active pools typically offer more stable returns and lower risks of large price impacts. However, they might offer lower percentage yields compared to smaller, higher-risk pools.

liquidity pools top dexs
Top DEX: DefiLlama

If you are curious as to which DEX has the top liquidity pools, Uniswap is the clear winner. Aside from a large total value locked (TVL) of almost $5 billion, Uniswap is present on 13 blockchains. This is a key contributing element, as the most successful liquidity pools must have a large amount of transactions.

Curve Finance follows Uniswap as the second largest DEX. It has a TVL of $2.29 billion. Curve is especially popular for its preference for stablecoins.

PancakeSwap is a Uniswap clone that originated on the Binance Smart Chain (now the BNB chain). It has the third-highest TVL for DEX, according to Defi Llama, coming in at $1.85 billion.

Knowledge is power

Now that you have been edified on liquidity pools, you should be more prepared to make informed decisions when you use DEXs. It is important to know the inner workings of crypto protocols. When dealing with a fast-growing asset class such as cryptocurrency, information is power. Ensure you always DYOR and only engage with decentralized ecosystems when you feel confident you are aware of both the risks and how to use them.

Frequently asked questions

Top crypto platforms | July 2024
SunContract SunContract Explore
Exodus Exodus Explore
BYDFi BYDFi Explore
Coinrule Coinrule Explore
Сoinex Сoinex Explore
Top crypto platforms | July 2024
SunContract SunContract Explore
Exodus Exodus Explore
BYDFi BYDFi Explore
Coinrule Coinrule Explore
Сoinex Сoinex Explore

Trusted

Disclaimer

In line with the Trust Project guidelines, the educational content on this website is offered in good faith and for general information purposes only. BeInCrypto prioritizes providing high-quality information, taking the time to research and create informative content for readers. While partners may reward the company with commissions for placements in articles, these commissions do not influence the unbiased, honest, and helpful content creation process. Any action taken by the reader based on this information is strictly at their own risk. Please note that our Terms and Conditions, Privacy Policy, and Disclaimers have been updated.

Ryan1.png
Ryan Glenn
Ryan Glenn is a journalist, writer, and author. Ryan is motivated to educate as many people as possible on the benefits of web3 and cryptocurrency. He has authored “The Best Book for Learning Cryptocurrency,” and runs an educational platform, web3school.us, dedicated to demystifying the crypto space. Ryan built the platform to transition tech-savvy and non-tech individuals into crypto and give everyone a baseline understanding of the different fields in the cryptosphere. Ryan is also an...
READ FULL BIO
Sponsored
Sponsored