12 minsPublished on 9/13/2022

What are liquidity pools in DeFi?

Liquidity pools are crucial for peer-to-peer trading in DeFi. Here’s everything you need to know about how they work.

By Sankrit K

Disclaimer: The following is for informational purposes only and should not be construed as financial advice.

Liquidity pools are the lifeblood of most modern-day decentralized finance (DeFi) protocols. They enable many of the most popular DeFi applications (dApps) to function and offer a way for crypto investors to earn yield on their digital assets. At the time of writing, there is estimated to be over $30 billion of value locked in liquidity pools. 

But what are liquidity pools and why do they play such an important role in DeFi?

This article explains what liquidity pools are, how they work, and why they're so crucial to the DeFi ecosystem.

What is a liquidity pool?

Liquidity is the ability of an asset to be sold or exchanged quickly and without affecting the price. In other words, liquidity is a measure of how easily an asset can be converted into cash.

A liquidity pool is a collection of digital assets accumulated to enable trading on a decentralized exchange (DEX). A DEX is an exchange that doesn’t rely on a third party to hold users' funds. Instead, DEX users transact with each other directly.

DEXs require more liquidity than centralized exchanges, however, because they don't have the same mechanisms in place to match buyers and sellers. They use Automated Market Makers (AMMs), which are essentially mathematical functions that dictate prices in accordance with supply and demand.

Liquidity pools are an essential part of decentralized exchanges as they provide the liquidity that is necessary for these exchanges to function. They are created when users lock their cryptocurrency into smart contracts that then enables them to be used by others — a bit like how companies transform money into debt or equity via loans.

You can think of liquidity pools as crowdfunded reservoirs of cryptocurrencies that anybody can access. In exchange for providing liquidity, those who fund this reservoir earn a percentage of transaction fees for each interaction by users.

Without liquidity, AMMs wouldn’t be able to match buyers and sellers of assets on a DEX, and the whole system would grind to a halt.

Here are some examples of popular liquidity pools and the blockchain network on which they operate:

A table of liquidity pools and their respective blockchain/ecosystem
Popular liquidity pools and their respective blockchain ecosystem

How do liquidity pools work?

Liquidity pools are created when users (called liquidity providers) deposit their digital assets into a smart contract. These assets can then be traded against each other on a DEX.

When a user provides liquidity, a smart contract issues liquidity pool tokens (LPTs). These tokens represent the liquidity provider's share of assets in the pool.

An illustration of how liquidity pools work
How liquidity pools work

Unlike traditional exchanges that use order books, the price in a DEX is typically set by an Automated Market Maker (AMM). When a trade is executed, the AMM uses a mathematical formula to calculate how much of each asset in the pool needs to be swapped in order to fulfill the trade.

The LPTs can be redeemed for the underlying assets at any time, and the smart contract will automatically issue the appropriate number of underlying tokens to the user.

Why are liquidity pools important?

Liquidity pools are at the heart of DeFi because peer-to-peer trading isn’t possible without them. Below are a few reasons why liquidity pools play such an important role.

Liquidity pools enable users to trade on DEXs

Liquidity pools provide the liquidity that is necessary for decentralized exchanges to function. Without them, it would be very difficult to trade digital assets on a DEX.

Liquidity pools provide the liquidity that is necessary for decentralized exchanges to function by allowing users to deposit their digital assets into a pool, and then trade the pool tokens on the DEX.

Liquidity Pools eliminate middlemen and centralized entities

Liquidity pools use Automated Market Makers (AMMs) to set prices and match buyers and sellers. This eliminates the need for centralized exchanges, which can greatly increase privacy and efficiency of all commerce activities.

Liquidity providers get incentives

Liquidity pools pave a way for LPs to earn interest on their digital assets. By locking their tokens into a smart contract, users can earn a portion of the fees that are generated from trading activity in the pool.

This provides an incentive for users to supply liquidity to the pool, and it helps to ensure that there is enough liquidity available to support trading activity on the DEX.

What is the purpose of liquidity pools?

The primary goal of liquidity pools is to facilitate peer-to-peer (P2P) trading on DEXs. By providing a steady supply of buyers and sellers, liquidity pools ensure that trades can be executed quickly and efficiently.

Most people prefer using liquidity pools as a financial tool to participate in yield farming (also called “liquidity mining”). Simply put, yield farming is the process of providing liquidity to a pool in order to earn a portion of the fees that are generated from trading activity.

An image of cows
Yield farming, not to be confused with actual farming

Yield farming is often compared to staking but is not the same. Read our in-depth article on the differences between yield farming and staking to learn more.

A slightly more advanced concept to learn is “superfluid staking”. 

As discussed, liquidity providers get tokens (LPTs) when they provide liquidity. With superfluid staking, those LPTs can then be staked in order to earn more rewards. So not only are users earning from the trading activity in the pool, they’re also compounding returns from staking the LPTs they receive.

How much do liquidity providers earn from liquidity pools?

Under the right conditions, a liquidity provider can earn a significant amount of money from providing liquidity to a pool.

Below is a table of some popular DEXs and corresponding payouts for LPs.

A table of the percentage of trade distributed to liquidity pools
Percentage of trade distributed to liquidity pools

The exact amount will depend on the size of the pool, the trading activity, and the fees that are charged.

Let's understand this with a simple analogy.

Suppose you and four of your friends invest $100 each to start a $500 lemonade stand. If you keep the business as is, then each of you would own one-fifth of the business ($500 divided by five people). But if you expand the business by buying more lemonade machines, then the percentage ownership of each person would change depending on how much money they invested.

The same principle applies to liquidity pools. The assets in the pool are analogous to the lemonade machines, and the users who supply those assets are like the friends who invested in the business.

An image of a pool
Take a dip in the liquidity pool

The size of a user's share in the pool depends on how much of the underlying asset they have supplied. So, if a pool has $100 worth of assets and a user has supplied 10% of those assets, then that user would own 10% of the pool and would earn 10% of the rewards that are distributed.

Are liquidity pools safe?

Like any investment, there are always risks involved. This is especially true when it comes to DeFi.

That said, liquidity pools have become increasingly popular and there is a growing amount of capital being deployed to them. As a result of increasing adoption and growing stakes, more people are involved than ever before to safeguard users’ funds through well-coded smart contracts.

Still, there are a few risks that you should know about.

Bugged smart contracts

One of the biggest risks when it comes to liquidity pools is smart contract risk. This is the risk that the smart contract that governs the pool can be exploited by hackers.

If hackers are able to find a bug in the smart contract, they can theoretically drain the liquidity pool of all its assets. For instance, a hacker could borrow a large number of tokens by taking a flash loan and execute a series of transactions that would eventually result in the funds draining, which is what happened in the 2020 flash loan attack on Balancer protocol.

This is why it's highly recommended to only invest in liquidity pools that have been audited by a reputable firm, thus reducing the likelihood of engaging with a vulnerable smart contract. 

High slippage due to low liquidity

Another risk to consider is low liquidity. If a pool doesn't have enough liquidity, it could experience high slippage when trades are executed.

What this essentially means is that the price difference between the performed transaction and the executed trade is large. This is because when the liquidity pool is small, even a small trade greatly alters the proportion of assets.

What if you still want to interact with the pool but at the same time not risk an unaffordable slippage?

Fortunately, most DEXs allow you to set slippage limits as a percentage of the trade. But keep in mind that a low slippage limit may delay the transaction or even cancel it.

For instance, if you are minting a hyped NFT collection alongside several others, then you’d ideally want your transaction to be executed before all the assets are bought. In such cases, you could benefit from setting a higher slippage limit.

Frontrunning transactions

Another common risk is frontrunning. This occurs when a user tries to buy or sell an asset at the same time that another user is executing a trade.

The first user is able to buy the asset before the second user, and then sell it back to them at a higher price. This allows the first user to earn a profit at the expense of the second user.

This is mainly seen on networks with slow throughput and pools with low liquidity (due to slippage).

Impermanent loss

Impermanent loss is the most common type of risk for liquidity providers.

It occurs when the price of the underlying asset in the pool fluctuates up or down. When this happens, the value of the pool's tokens will also fluctuate.

If the price of the underlying asset decreases, then the value of the pool's tokens will also decrease.

The reason this is considered a risk is that there is always the potential that the price of the underlying asset could decrease and never recover. If this happens, then the liquidity provider would experience a loss.

An impermanent loss could also occur when the price of the asset increases greatly. This causes the users to buy from the liquidity pool at a price lower than that of the market and sell elsewhere. If the user exits the liquidity pool when the price deviation is large, then the impermanent loss will be “booked” and is therefore permanent.

Liquidity pools with assets of low volatility such as stablecoins experience the least impermanent loss.

How to create a liquidity pool

In order to create a liquidity pool, you need to deposit an equal value of two different assets into the pool. These are called “trading pairs”.

For example, let's say you want to create a pool that contains the trading pair ETH/USDC. You would need to deposit an equal value of both assets into the pool.

Traditionally, you would have to acquire the equivalent value of assets and then manually put them into the pool.

Some protocols, like Bancor and Zapper, are simplifying this by allowing users to provide liquidity with just one asset. This saves a lot of time and effort for users as they don't have to perform manual calculations or acquire the second asset.

Below are some useful resources if you wish to create a liquidity pool:

Frequently Asked Questions (FAQs)

Can you make money with liquidity pools?

Yes, you can make money by providing liquidity to a pool. This is because you will earn fees whenever a trade is executed in the pool.

At the same time, recent findings show that several liquidity providers themselves are actually losing more money than they are making.

Bull markets are ideal for earning profits from liquidity pools as there is typically a lot of trading activity during these times and the price of assets also go up, thus lowering your impermanent loss (as long as one of the assets in the liquidity pair is not a stablecoin).

In a bear market, on the other hand, impermanent loss could be far greater due to the market downturn. This is only true, however, when the fall in price is greater than the assets’ appreciation during the bull market.

What is a good liquidity pool?

A good liquidity pool is one that has been audited by a reputable firm, has a large amount of liquidity, and high trading volume.

It's also important to consider the fees associated with the pool as well as the risks involved.

The redistribution of the fees to liquidity providers should be large and the protocol should ideally have mechanisms in place like protection against impermanent loss and on-chain insurance to protect liquidity providers.

When is it a good time to exit a liquidity pool?

It's generally a good idea to exit a liquidity pool when the price of the underlying assets in the pool starts to become very volatile. This is because the risk of impermanent loss becomes greater when the prices of the assets in the pool fluctuate greatly.

Begin your DeFi journey with MoonPay

DeFi can help you earn interest and grow your crypto portfolio. To get started, simply buy cryptocurrency via MoonPay using your credit card or any other preferred payment method.

Sankrit K
Written bySankrit K