A328/

Defi

What is a Liquidity Pool and its Role in the DeFi Ecosystem?

5 min read
What is a Liquidity Pool and its Role in the DeFi Ecosystem?

A liquidity pool is a smart contract that holds reserves of two or more tokens so people can trade or borrow against them without a counterparty or an order book. Anyone can deposit tokens, becoming a liquidity provider (LP), and earns a share of the fees the pool collects. Pools are the core mechanism behind decentralized exchanges (DEXs) and on-chain lending.

This guide explains how pools price trades, what providers earn, the main risk (impermanent loss), and the questions to settle if you are building a pool-based product.

What Is a Liquidity Pool?

What is a Liquidity Pool?

In a traditional exchange, buyers and sellers post orders and a market maker fills the gaps. In a DEX built on an automated market maker (AMM), a pool replaces the order book. Traders swap against the pool's reserves, and a formula sets the price. LPs supply the reserves and are paid fees for it.

Pools also power lending markets: depositors supply an asset to a shared pool, borrowers take from it against collateral, and interest is shared among depositors. The "lending pool" and "finance pool" people search for are this model.

How Do Liquidity Pools Work?

How do Liquidity Pools Work

1. A pool is created

A contract holds two tokens, for example ETH and a stablecoin such as USDC. The first provider sets the opening ratio, which sets the starting price.

2. Providers deposit

Providers deposit both tokens in equal value. In Uniswap v2, they receive fungible ERC-20 pool tokens representing a proportional share of the reserves; in v3, providers choose a price range and receive an NFT position (Uniswap documentation).

3. Trades are priced by a formula

The most common AMM rule is the constant product formula, x * y = k, where x and y are the two token reserves and k must stay the same or increase after each trade. Bigger trades relative to the pool's depth move the price more. That price movement is slippage.

Worked example: a pool holds 10 ETH and 20,000 USDC, so k = 200,000 and ETH trades at 2,000 USDC. A trader who buys 1 ETH must leave the pool with 9 ETH, so the USDC side must reach 200,000 / 9 = 22,222. The trader pays about 2,222 USDC (before fees) for that 1 ETH, a price above 2,000 because the trade moved the pool's ratio.

4. Fees accrue to providers

Each swap pays a fee, set per pool and protocol version, which stays in the pool and raises the value of every LP share. Providers collect their share when they withdraw.

5. Withdrawal

Providers redeem their pool tokens for their share of the reserves plus accumulated fees. Note that the mix of tokens they get back differs from what they put in, which is where impermanent loss comes from.

What Are the Advantages of Liquidity Pools?

  • Always-on trading: a pool can quote a price at any time, without a market maker.
  • Open participation: anyone can provide liquidity, and new tokens can get a market without a listing.
  • Fee income: providers earn a share of trading fees.
  • Composability: other contracts can call a pool, which is how aggregators, lending markets and yield products are built on top.
  • Transparency: reserves and trades are visible on-chain.

Risks of Providing Liquidity

Impermanent loss

When the relative price of the two tokens changes, arbitrage traders rebalance the pool, and the provider ends up holding more of the token that fell. Using the pool above: if ETH rises to 4,000 USDC, the pool rebalances to about 7.07 ETH and 28,284 USDC, worth about 56,569 USDC. Simply holding the original 10 ETH and 20,000 USDC would be worth 60,000. The difference, about 5.7%, is impermanent loss. Fees must outweigh it for providing liquidity to pay off. The loss only becomes permanent if you withdraw.

Smart contract risk

Funds are only as safe as the code. Use audited, battle-tested contracts and read the smart contract audit reports.

Token and rug-pull risk

Pools with unknown tokens can be drained by their creators, or the token can lose its value. Stablecoin pairs reduce price risk but add peg and issuer risk.

Oracle manipulation

If other protocols read a thin pool's spot price, an attacker can move that price within one transaction. Price Oracle Manipulation ranks second on the OWASP Smart Contract Top 10 (2025).

Use Cases of Liquidity Pools

Decentralized exchanges

Pools are the market for every token pair on an AMM DEX.

Lending and borrowing

Depositors supply assets to a pool and earn interest; borrowers post collateral to draw from it.

Yield farming and incentives

Protocols sometimes add reward tokens to attract liquidity. Treat these rewards as marketing spend by the protocol, not guaranteed income.

Stablecoin swaps

Pools designed for similarly priced assets allow large swaps with low slippage.

Derivatives and other products

Some derivatives and structured products draw their liquidity from pools as well.

Price data

Pools can feed price data to other contracts, but spot prices from low-liquidity pools are easy to manipulate, so use time-weighted averages or dedicated oracles.

Building a Pool-Based Product

If you are building a DEX, lending product or tokenized-asset platform, these are the decisions that matter most in our blockchain projects:

  • Pricing curve: constant product for volatile pairs, specialized curves for stable assets, concentrated ranges for capital efficiency.
  • Fee model: who pays, who earns, and whether the protocol takes a cut.
  • Oracle design: never rely on a single pool's spot price for anything that holds value.
  • Audit and testing: independent review plus testing against attack scenarios before launch, and a response plan for incidents.
  • Compliance: depending on jurisdiction and users, KYC, AML and securities rules may apply.

Webisoft builds this through our blockchain development practice, including blockchain development services for DeFi.

Frequently Asked Questions

Conclusion

A liquidity pool replaces the order book with reserves and a pricing formula. Providers earn fees and carry impermanent loss and contract risk. For anyone building a product, the pricing curve, oracle design and audit quality decide whether the pool is safe to use.

  1. The price of assets in a liquidity pool is determined by a mathematical formula called an automated market maker (AMM). The AMM algorithm calculates the price based on the ratio of each asset’s quantity in the pool. As trades occur, the AMM adjusts the asset prices to maintain the balance between them, ensuring that the pool remains in equilibrium.

  2. Liquidity pools generate revenue through fees charged on trades. When users trade against the pool, they pay a small fee, typically a percentage of the transaction. These fees are distributed among liquidity providers in proportion to their share of the pool. By participating in a pool, users can earn a portion of these fees as a form of passive income.