Liquidity Pools
Liquidity pools are the backbone of decentralized exchanges. Unlike Centralized Exchanges (CEX) where market makers place orders on a book, Decentralized Exchanges (DEX) use Smart Contracts holding paired assets that anyone can trade against.
No intermediaries. No permission required. No recourse if issues arise.
TL;DR
- Liquidity pools replace order books—trade against a smart contract, not other traders
- Constant product formula (x × y = k): larger trades = worse prices
- Impermanent loss is the cost when prices diverge; arbitrageurs profit, LPs pay
- Concentrated liquidity (V3/V4) is more capital efficient but amplifies IL risk
- High APY is usually temporary token incentives, low TVL inflation, or IL-ignorant math
- Before LP'ing: verify fees exceed IL, check LP token locks, stick to audited protocols
What Is a Liquidity Pool?
A liquidity pool is a smart contract holding two (or more) tokens that enables trading without a traditional order book. Instead of matching buyers with sellers, traders swap directly against the pool's reserves.
Figure 1: Basic liquidity pool mechanics.
graph LR
subgraph "Liquidity Pool"
POOL["Smart Contract<br/>━━━━━━━━━━━━<br/>ETH: 100<br/>USDC: 100,000"]
end
LP["Liquidity Provider"]
TRADER["Trader"]
LP -->|"Deposits ETH + USDC"| POOL
POOL -->|"LP Tokens"| LP
TRADER -->|"Swaps ETH for USDC"| POOL
POOL -->|"Returns USDC"| TRADER
style POOL fill:#E6E6FA
style LP fill:#90EE90
style TRADER fill:#FFD700
Key Components
| COMPONENT | FUNCTION |
|---|---|
| Smart Contract | Holds tokens, executes swaps, enforces rules |
| Token Reserves | The actual assets in the pool (e.g., ETH + USDC) |
| LP Tokens | Receipt tokens proving your share of the pool |
| Pricing Formula | Algorithm determining swap rates (usually x × y = k) |
How It Differs from Order Books
On a CEX, you trade against other people's orders. On a DEX with liquidity pools, you trade against a pool of assets governed by math.
| ASPECT | ORDER BOOK (CEX) | LIQUIDITY POOL (DEX) |
|---|---|---|
| Counterparty | Other traders | Smart contract |
| Price discovery | Bid/ask matching | Algorithmic formula |
| Liquidity source | Market makers | Anyone (LPs) |
| Withdrawal risk | Exchange can freeze | Permissionless |
| Execution | Depends on orders | Always available (if pool exists) |
How Liquidity Pools Work
The Constant Product Formula
Most liquidity pools use the constant product formula, pioneered by Uniswap:
Where:
- x: quantity of token A in the pool
- y: quantity of token B in the pool
- k: constant (remains unchanged through swaps)
Figure 2: Constant product formula in action.
graph TD
subgraph "Initial State"
I["ETH: 100 | USDC: 100,000<br/>k = 10,000,000<br/>Price: 1 ETH = 1,000 USDC"]
end
subgraph "After Swap"
A["ETH: 110 | USDC: 90,909<br/>k = 10,000,000<br/>Price: 1 ETH = 826 USDC"]
end
SWAP["Trader sells 10 ETH<br/>Receives 9,091 USDC"]
I --> SWAP --> A
style I fill:#90EE90
style SWAP fill:#FFD700
style A fill:#FFB6C1
The formula enforces scarcity: as you buy one token, it becomes more expensive. As you sell, it becomes cheaper.
Providing Liquidity
To become a Liquidity Provider (LP), you deposit both tokens in the pool's current ratio. In return, you receive LP Tokens representing your share.
Figure 3: LP deposit and token minting flow.
sequenceDiagram
participant You
participant Pool
participant LPToken as LP Token Contract
You->>Pool: Deposit 1 ETH + 1,000 USDC
Pool->>Pool: Verify correct ratio
Pool->>LPToken: Mint LP tokens
LPToken->>You: Receive LP tokens (1% of pool)
Note over You: LP tokens prove ownership
When you withdraw, you burn your LP tokens and receive your proportional share of whatever's in the pool—which may be different from what you deposited.
Fee Distribution
Every swap pays a fee (typically 0.3% on Uniswap V2). This fee stays in the pool, increasing the value of LP tokens over time.
Figure 4: Fee distribution to LPs.
graph LR
TRADER["Trader swaps<br/>1,000 USDC → ETH"]
FEE["Fee: 3 USDC<br/>(0.3%)"]
POOL["Pool reserves<br/>increase by 3 USDC"]
LPS["All LP token holders<br/>share proportionally"]
TRADER --> FEE --> POOL --> LPS
style TRADER fill:#FFD700
style FEE fill:#FFB6C1
style POOL fill:#E6E6FA
style LPS fill:#90EE90
Higher trading volume generates more fees. However, volume often correlates with volatility, which increases impermanent loss.
Impermanent Loss
Impermanent Loss (IL) is the cost of providing liquidity when token prices change. It's the difference between holding tokens in your wallet versus depositing them in a pool.
Not Actually "Impermanent"
The term is misleading. The loss becomes permanent upon withdrawal. It's only "impermanent" in that prices could theoretically return to their original ratio.
How It Happens
When prices diverge, arbitrageurs rebalance the pool. They profit from the price difference, and that profit comes from LPs.
Figure 5: Arbitrage-driven impermanent loss.
sequenceDiagram
participant Market as External Market
participant Arb as Arbitrageur
participant Pool
Note over Pool: ETH: 100 | USDC: 100,000<br/>Pool price: $1,000/ETH
Note over Market: ETH price rises to $1,100
Arb->>Pool: Buy cheap ETH from pool
Pool->>Arb: Sells ETH at ~$1,000
Arb->>Market: Sell ETH at $1,100
Note over Arb: Profit: ~$100/ETH
Note over Pool: ETH: 95.3 | USDC: 104,880<br/>Pool now matches market
Note over Pool: LPs lost value to arbitrage
The Math
Impermanent loss depends on how much prices diverge from your entry point:
| PRICE CHANGE | IMPERMANENT LOSS |
|---|---|
| ±25% | 0.6% |
| ±50% | 2.0% |
| ±100% (2x) | 5.7% |
| ±200% (3x) | 13.4% |
| ±400% (5x) | 25.5% |
Figure 6: Impermanent loss vs price divergence.
xychart-beta
title "Impermanent Loss vs Price Change"
x-axis "Price Ratio" [0.5, 0.75, 1.0, 1.5, 2.0, 3.0, 5.0]
y-axis "IL (%)" 0 --> 30
line [2.0, 0.6, 0, 2.0, 5.7, 13.4, 25.5]
A Concrete Example
You deposit 1 ETH ($1,000) + 1,000 USDC into a pool. Total value: $2,000.
Scenario: ETH doubles to $2,000
| STRATEGY | ETH | USDC | TOTAL VALUE |
|---|---|---|---|
| Just hold | 1 ETH ($2,000) | 1,000 USDC | $3,000 |
| LP position | 0.707 ETH ($1,414) | 1,414 USDC | $2,828 |
| Difference | - | - | -$172 (5.7%) |
You still made money ($2,828 vs $2,000 initial). But you made less than if you'd just held. That difference is impermanent loss.
When Impermanent Loss Hurts Most
Impermanent loss is most significant when:
- One token appreciates significantly: You end up with less of the appreciating asset
- One token depreciates significantly: You end up with more of the depreciating asset
- High volatility: Constant rebalancing transfers value to arbitrageurs
- Low fees: Trading fees don't compensate for IL
Impermanent loss is manageable when:
- Prices stay stable: Stablecoin pairs (USDC/USDT) have minimal IL
- High volume: Fees can exceed IL
- Prices revert: If prices return to entry ratio, IL disappears
Major Protocols
Uniswap
The original Automated Market Maker (AMM). Launched in 2018, it introduced the constant product formula that most DEXs still use.
Version History:
| VERSION | LAUNCH | KEY FEATURE |
|---|---|---|
| V1 | 2018 | ETH pairs only |
| V2 | 2020 | Any token pair, flash swaps |
| V3 | 2021 | Concentrated liquidity |
| V4 | 2025 | Hooks, singleton contract, native ETH |
Uniswap V3: Concentrated Liquidity
V3 lets LPs specify price ranges for their liquidity instead of spreading it across all prices. This is known as concentrated liquidity.
Figure 7: V2 vs V3 liquidity distribution.
graph LR
subgraph "V2: Full Range"
V2["Liquidity spread $0 to ∞<br/>Capital efficiency: Low"]
end
subgraph "V3: Concentrated"
V3["Liquidity in $900-$1,100 range<br/>Capital efficiency: High"]
end
V2 -->|"Evolution"| V3
style V2 fill:#FFE4B5
style V3 fill:#90EE90
Concentrated liquidity means more fees when price stays in range—but amplified impermanent loss if price moves outside your range.
Uniswap V4: Hooks
V4 introduces "hooks"—plugin contracts that execute before or after pool actions. Developers can customize:
- Dynamic fees based on volatility
- On-chain limit orders
- MEV redistribution to LPs
- Custom pricing curves
Curve Finance
Specializes in stablecoin and pegged asset swaps. Uses a modified formula (StableSwap) optimized for assets that should trade 1:1.
Figure 8: Curve vs Uniswap for stablecoins.
graph LR
subgraph "Curve Advantage"
STABLE["USDC/USDT/DAI pool"]
LOW["Ultra-low slippage<br/>for stable pairs"]
end
subgraph "vs Uniswap"
UNI["Same pair on Uniswap"]
HIGH["Higher slippage<br/>constant product penalty"]
end
STABLE --> LOW
UNI --> HIGH
style LOW fill:#90EE90
style HIGH fill:#FFB6C1
Curve pools have historically held billions in TVL because stable-to-stable swaps are a massive use case.
Curve Exploit (July 2023)
In July 2023, several Curve pools were exploited for approximately $70 million due to a Reentrancy vulnerability in the Vyper compiler. The exploit affected pools including alETH/ETH, CRV/ETH, and pETH/ETH. About $50 million was eventually recovered through white hat returns and negotiations.
Balancer
Allows pools with more than two tokens and custom weightings. A standard Uniswap pool is 50/50. Balancer pools can be 80/20, 60/20/20, or any configuration.
| POOL TYPE | USE CASE |
|---|---|
| 50/50 | Standard trading pairs |
| 80/20 | Reduce IL on volatile assets |
| Multi-token | Index fund-like exposure |
Raydium (Solana)
Combines AMM pools with an order book (Serum/OpenBook). Liquidity can be accessed both ways, theoretically providing better execution.
Liquidity Pool Risks
Smart Contract Risk
Pools are only as secure as their code. Exploits happen.
| EXPLOIT TYPE | MECHANISM |
|---|---|
| Reentrancy | Contract called recursively before state updates |
| Oracle manipulation | Price feeds exploited to drain pools |
| Flash Loan attacks | Massive temporary capital used to manipulate prices |
| Admin key compromise | Privileged functions exploited |
Mitigation:
- ☑ Stick to audited, battle-tested protocols
- ☑ Check time since deployment (Lindy Effect)
- ☑ Verify admin key setup (Multisig, Timelock)
- ☒ Don't assume audited = safe
Rug Pulls
In permissionless systems, anyone can create a pool. Rug pull scam patterns:
- Deploy token with hidden minting function
- Create pool, provide initial liquidity
- Promote token, attract buyers
- Drain pool by minting tokens or removing liquidity
Figure 9: Anatomy of a rug pull.
sequenceDiagram
participant Scammer
participant Pool
participant Victims
Scammer->>Pool: Creates pool with SCAM/ETH
Scammer->>Pool: Adds initial liquidity
Note over Scammer: Promotes token
Victims->>Pool: Buy SCAM token
Note over Pool: Price rises
Scammer->>Pool: Removes all liquidity
Note over Pool: Pool emptied
Victims->>Pool: Try to sell
Note over Victims: No liquidity to exit
Red Flags:
- ☒ Unlocked liquidity (LP tokens not locked or burned)
- ☒ Anonymous team with no track record
- ☒ Unverified contract source code
- ☒ Admin functions that can mint, pause, or blacklist
- ☒ Honeypot patterns (can buy but not sell)
Impermanent Loss (Revisited)
IL is inherent to the AMM model. LPs provide liquidity and pay the cost of IL in exchange for fees. The question is whether fees exceed IL.
For volatile pairs, they often don't.
MEV Extraction
Bots can front-run swaps, sandwich transactions, and extract value from pools. Maximal Extractable Value (MEV) is an inherent feature of public mempools.
Protection Options
Use private Mempools (Flashbots Protect), MEV-aware DEX aggregators (CoW Swap), or set tight slippage tolerances. None are perfect.
Evaluating Pools
Key Metrics
| METRIC | WHAT IT TELLS YOU |
|---|---|
| TVL | Total Value Locked; larger = more stable pricing |
| Volume | Trading activity; higher = more fee income |
| APR/APY | Projected returns (often inflated by token incentives) |
| IL Exposure | How volatile is the pair? |
| Protocol Age | Lindy effect; older = battle-tested |
APY Warnings
High APYs are almost always temporary or misleading:
- Token incentives: Protocol pays you in their token, which often dumps
- Low TVL: High fees on small pool = unsustainable
- Calculation tricks: APY = (last 24h fees × 365), ignoring IL
Figure 10: High APY due diligence checklist.
graph TD
HIGH["Pool showing 500% APY"]
Q1["Is it from trading fees<br/>or token incentives?"]
Q2["How long has APY<br/>been this high?"]
Q3["What's the TVL?<br/>Is it sustainable?"]
Q4["What's your IL exposure?"]
HIGH --> Q1
Q1 --> Q2
Q2 --> Q3
Q3 --> Q4
style HIGH fill:#FF6B6B
style Q1 fill:#FFE4B5
style Q2 fill:#FFE4B5
style Q3 fill:#FFE4B5
style Q4 fill:#FFE4B5
Liquidity Lock Verification
Before buying tokens from a new pool, verify:
- Are LP tokens locked? (Check contract or locking service)
- For how long? (24 hours is meaningless; years matter)
- What percentage? (10% locked is still 90% rug risk)
Tools like DeFiLlama, DEXScreener, and TokenSniffer can help verify.
Liquidity Pool Strategies
Stable Pairs
Providing liquidity to stable-stable pairs (USDC/USDT, DAI/USDC):
- ☑ Minimal impermanent loss
- ☑ Consistent fee income
- ☒ Lower APY than volatile pairs
- ☒ Still exposed to smart contract and depeg risk
Correlated Assets
Pairs that move together (ETH/stETH, BTC/wBTC):
- ☑ Reduced IL (prices should stay ~1:1)
- ☑ Higher volume than stable pairs
- △ Depeg events can cause significant IL
Concentrated Liquidity (V3)
Setting tight ranges on Uniswap V3:
- ☑ Higher fee capture when in range
- ☑ More capital efficient
- ☒ Amplified IL if price exits range
- ☒ Requires active management
- ☒ Position earns nothing when out of range
Single-Sided Liquidity
Some protocols allow depositing one token:
- ☑ Simpler UX
- ☒ Protocol converts half to the other token anyway
- ☒ You still have IL exposure
CEX Liquidity vs DEX Liquidity
Understanding where liquidity comes from matters for execution quality.
| FACTOR | CEX (MARKET MAKERS) | DEX (LIQUIDITY POOLS) |
|---|---|---|
| Provider | Professional firms | Anyone with capital |
| Obligation | None (in crypto) | None (permissionless) |
| Withdrawal | Can leave instantly | Can withdraw anytime |
| Accountability | Reputational | Smart contract only |
| Crisis behavior | Often withdraw | Passive; always available |
| Large order execution | ☑ Usually better | ☒ Usually worse |
During the October 2025 crash, CEX market makers withdrew liquidity within minutes. DEX pools remained—not because they're better, but because they're automated. No one can "withdraw" a smart contract.
This cuts both ways: passive availability during crashes, but no one managing risk or providing depth when you need it.
References
AMM Fundamentals
- How Uniswap Works — Official Uniswap V2 documentation on the constant product formula
- Uniswap V4 Overview — Official documentation on V4 architecture and hooks
- Uniswap V4 Whitepaper — Technical specification for V4
Impermanent Loss
- What is Impermanent Loss? — Uniswap Labs official explanation
- Impermanent Loss Calculator — DailyDeFi interactive calculator
- Impermanent Loss in Uniswap V3 — Auditless analysis of concentrated liquidity IL
Protocol Documentation
- Curve Finance — Stablecoin-optimized AMM
- Balancer Docs — Multi-token weighted pools
- Uniswap V4 Hooks — Official hooks documentation
Security & Exploits
- Curve Finance Exploit Explained — Hacken technical breakdown
- Curve Pools Exploit Analysis — Chainalysis on-chain analysis
- Vyper Vulnerability Post-Mortem — Technical analysis of the compiler bug
Concentrated Liquidity
- Uniswap V4 Features Explained — Three Sigma overview
- Liquidity Mechanics in Uniswap V4 — QuillAudits technical deep dive
Related Articles
- Price Impact, Slippage & Spread — How your trades affect and are affected by liquidity
- Market Makers — How CEX liquidity providers operate
Changelog
| DATE | AUTHOR | NOTES |
|---|---|---|
| 2025-12-24 | Artificial. | Generated by robots. |
| 2026-01-04 | Denizen. | Reviewed, edited, and curated by humans. |