DeFi

Liquidity Pools in DeFi

A liquidity pool is a smart contract holding reserves of two or more tokens that enable decentralised trading via an automated market maker (AMM) algorithm. Instead of a traditional order book with buyers and sellers, AMMs use the token ratio in the pool to determine prices algorithmically. Traders swap against the pool; liquidity providers earn fees in return for supplying the reserves.

Liquidity pools are the infrastructure underlying most of decentralised finance. Every swap on Uniswap, Curve, or PancakeSwap executes against a liquidity pool rather than a traditional order book. Understanding how they work — including the mathematics of price determination, what liquidity providers earn, and what risks they take — is foundational knowledge for anyone participating in DeFi.

The Problem Liquidity Pools Solve

Traditional exchanges use order books: buyers and sellers post orders and are matched against each other. This requires continuous market makers who are willing to quote both buy and sell prices. In decentralised, permissionless protocols, you cannot rely on professional market makers to be present for every token pair. Liquidity pools solve this by replacing the market-making function with a mathematical formula and a pool of pre-deposited capital.

The x*y=k Constant Product Formula

The foundational AMM formula, introduced by Uniswap v1:

x × y = k

Where x = quantity of Token A in the pool, y = quantity of Token B, k = a constant.

When a trader swaps Token A for Token B, they add x to the pool and remove y. The amounts exchanged are set so that x × y remains constant at k. The price of Token B in terms of Token A is simply y/x — the ratio of reserves.

Example: A pool holds 10 ETH and 20,000 USDC (k = 200,000). ETH price = 20,000 ÷ 10 = $2,000. If a trader swaps 1 ETH in: new x = 11 ETH, and new y must = 200,000 ÷ 11 = 18,181 USDC. The trader receives 20,000 − 18,181 = 1,819 USDC for 1 ETH (below the pre-trade price of $2,000, due to price impact).

This price impact — the larger the trade relative to pool size — is the AMM equivalent of slippage. See Slippage in Crypto Trading for more.

Liquidity Provider (LP) Economics

Liquidity providers deposit equal values of both tokens (e.g. $5,000 of ETH and $5,000 of USDC to enter the ETH/USDC pool). In return they receive LP tokens representing their proportional share of the pool. Every swap through the pool generates a fee (e.g. 0.3% on Uniswap v2 standard pools), distributed to LP token holders proportionally.

As the pool accumulates fees, its total value increases, and LP tokens appreciate. When LPs withdraw, they receive their proportional share of both tokens (at the current ratio, which may differ from when they entered) plus accumulated fees.

Concentrated Liquidity (Uniswap v3)

Uniswap v3 introduced concentrated liquidity — LPs can specify a price range in which to provide liquidity (e.g. ETH between $1,800 and $2,200). Their capital is concentrated within that range, generating higher fee income per dollar when price trades within it. When price moves outside the range, the LP holds only one token and earns no fees until price returns.

Concentrated liquidity is a powerful tool for sophisticated LPs but significantly increases impermanent loss risk and requires active management of price ranges. Passive depositors are generally better served by full-range pools or stable-pair pools on Curve.

Stable Pools and Curve Finance

Curve Finance specialises in stablecoin-to-stablecoin and pegged-asset pools (e.g. USDC/USDT, stETH/ETH). It uses a modified AMM formula optimised for assets that trade near parity — allowing extremely large swaps with minimal price impact. For stable pairs, impermanent loss is negligible, and LPs earn fees from the high volume of large institutional stablecoin swaps. Curve is the dominant venue for large stablecoin conversions in DeFi.

Key Risks for Liquidity Providers

  • Impermanent loss: The most common LP risk. Occurs when the price ratio of the two deposited assets changes significantly from the time of deposit. Covered in depth in the Yield Farming article.
  • Smart contract risk: A bug or exploit in the pool contract can drain all deposited funds. Use only audited, battle-tested protocols.
  • Token risk: If one of the two tokens in a pool goes to zero, the LP's position is entirely converted to the worthless token (the AMM auto-rebalances). Providing liquidity with low-quality tokens is extremely high risk.

Summary

Liquidity pools enable decentralised trading via smart contracts that hold token reserves. The x*y=k AMM formula automatically sets prices based on the reserve ratio — larger trades cause more price impact. LPs earn trading fees in exchange for depositing capital, but face impermanent loss when the ratio of deposited assets changes and smart contract risk from protocol bugs. Stablecoin pools minimise impermanent loss; concentrated liquidity maximises fee efficiency at the cost of active management. Size LP positions relative to smart contract and impermanent loss risk.