Automated Market Makers (AMMs) and liquidity pools are the foundational technology behind decentralized exchanges. Instead of matching buyers and sellers through an order book, AMMs use smart contracts and mathematical formulas to determine prices and execute trades automatically. Anyone can provide liquidity to these pools and earn a share of trading fees. This guide explains how the technology works, the math behind it, how to earn as an LP, and how AMMs have evolved.
An Automated Market Maker (AMM) is a type of decentralized exchange protocol that uses smart contracts and mathematical formulas — instead of traditional order books — to facilitate token trading. In a traditional exchange, trades happen when a buyer's bid price matches a seller's ask price. In an AMM, prices are determined algorithmically based on the ratio of assets in a liquidity pool.
The AMM model was pioneered by Uniswap in 2018 and has since become the dominant architecture for DEX platforms. Every major DEX — PancakeSwap, Raydium, Curve, SushiSwap, Trader Joe — uses some variant of the AMM model. AMMs enable permissionless, always-on liquidity: anyone can trade at any time, and anyone can provide liquidity to earn fees.
💡 Key Insight: AMMs solved the "cold start" liquidity problem that plagued early DEXs. Order book DEXs needed active market makers to provide liquidity — a chicken-and-egg problem. AMMs allow passive liquidity provision by anyone, bootstrapping liquidity from day one.
| Feature | AMM | Order Book |
|---|---|---|
| Price discovery | Mathematical formula | Supply/demand matching |
| Market makers | Passive LPs (anyone) | Professional market makers |
| Always liquid | Yes (if pool exists) | No (requires active orders) |
| Best price for large trades | Variable (slippage) | Better (deep books) |
| Token listing | Permissionless | Requires approval |
The most widely used AMM formula is the constant product formula, introduced by Uniswap v2:
x × y = k
Where x = quantity of Token A, y = quantity of Token B, and k = a constant value that remains unchanged through all trades.
When a trader buys Token A from the pool, they add Token B (payment) to the pool and remove Token A. This changes the ratio of x to y, and since k must remain constant, the price of Token A increases (becomes scarcer) while Token B decreases in price (becomes more abundant).
The larger your trade relative to the pool size, the more the ratio changes, and the worse your execution price. This "price impact" or slippage is an inherent property of the constant product formula. A $1,000 trade in a $10M pool causes minimal slippage; the same trade in a $50,000 pool causes substantial slippage.
Example: BNB/USDT pool with 100 BNB and 30,000 USDT (k = 3,000,000, implied price: 300 USDT/BNB). A trader buys 10 BNB: they add y USDT such that (100-10) × (30,000 + y) = 3,000,000. Solving: 90 × (30,000 + y) = 3,000,000, so y = 3,333.33 USDT. They paid 3,333 USDT for 10 BNB — an effective price of $333.33/BNB, not the pool's initial $300 rate. The 11% price impact is due to the small pool size in this example.
A liquidity pool is a smart contract holding reserves of two tokens. When you add liquidity, you deposit both tokens in equal value. In return, you receive LP tokens — ERC-20 tokens (or SPL on Solana) that represent your fractional ownership of the pool.
When you later withdraw your liquidity by burning your LP tokens, you receive your proportional share of the pool — which may differ from what you deposited due to trading activity (impermanent loss) but includes your share of accumulated trading fees.
On a permissionless AMM like PancakeSwap or Uniswap, anyone can create a new liquidity pool for any pair of tokens — no approval required. The pool creator sets the initial price by depositing tokens in the ratio they choose. If they deposit 1 ETH and 3,000 USDT, they're setting an initial price of $3,000 per ETH.
Every swap on a DEX routes through one or more liquidity pools. Complex trades might use multi-hop routing — for example, swapping Token A → BNB → Token B across two separate pools. The DEX router automatically finds the path that minimizes slippage and maximizes output.
Providing liquidity on a DEX is a way to earn passive income on crypto you already hold. Here's how to do it on PancakeSwap (BNB Chain):
Go to the DEX, click Connect Wallet, and connect MetaMask or Trust Wallet with BNB Chain configured.
Find the Liquidity or Pool section of the DEX interface.
Choose the two tokens you want to provide liquidity for — for example, BNB and USDT.
On v3 concentrated liquidity pools, select the price range where your liquidity will be active.
Approve each token for the pool contract, then confirm the liquidity deposit transaction in your wallet.
You now hold LP tokens representing your pool position. Fees accrue to your position automatically as trading occurs.
Liquidity providers earn a share of all trading fees generated by their pool, proportional to their share of total pool liquidity. Fee tiers on PancakeSwap v3:
Your annual percentage return as an LP depends on: trading volume, your pool share, fee tier, and impermanent loss. A pool with $1M in liquidity generating $500K in daily volume at 0.25% fee produces $1,250/day in LP fees. An LP with 10% of that pool earns $125/day — a 4.56% annual return on their $1M position, just from fees.
Impermanent loss (IL) is the temporary reduction in value experienced by liquidity providers when the price ratio of their pooled tokens changes relative to when they deposited. It's called "impermanent" because the loss only materializes if you withdraw at the unfavorable ratio — if prices return to their original ratio, the loss disappears.
When you deposit BNB and USDT in a 50/50 pool, the AMM rebalances your position automatically as prices change. If BNB doubles in price, the pool sells BNB and accumulates USDT as external arbitrageurs bring the pool price to market. You end up holding less BNB (and more USDT) than if you'd simply held outside the pool — that's impermanent loss.
The IL formula: for a price change ratio r, IL = 2√r/(1+r) - 1. For a 2x price increase (r=2): IL = 2√2/3 - 1 = -5.7%. This means you'd be 5.7% worse off providing liquidity vs simply holding, before accounting for fees earned.
Impermanent loss is offset by trading fees. High-volume pools generate enough fee income to more than compensate for IL over time. Stablecoin pools (USDT/USDC) have near-zero IL since both tokens maintain the same price. Long-term LPs in high-volume pools consistently outperform simple holding strategies.
Yield farming is the practice of maximizing returns by deploying LP positions across multiple protocols, often involving staking LP tokens to earn additional rewards. Liquidity mining specifically refers to earning a DEX's native token as a reward for providing liquidity.
On PancakeSwap, LPs can stake their LP tokens in "Syrup Pools" to earn CAKE (PancakeSwap's token) on top of trading fees. This boosts total APY significantly — a pool with 15% fee APY might offer 25–40% total APY when liquidity mining rewards are included.
Concentrated Liquidity Market Makers (CLMMs), introduced by Uniswap v3 and now standard across modern DEXs, allow LPs to specify a price range for their liquidity. Instead of providing liquidity across the entire price curve (0 to ∞), you concentrate your capital where trading actually happens.
This dramatically improves capital efficiency. An LP who concentrates liquidity in the BNB price range of $280–$340 earns the same fees as an LP with 10x more capital in a standard v2 pool — because within that range, they provide the same depth of liquidity. The tradeoff: if the price moves outside your range, your position stops earning fees until price returns to the range.
PancakeSwap v3 (the engine behind DexCrypto's BNB Chain DEX) and DexCrypto's Solana DEX both support CLMM, giving LPs professional-grade capital efficiency.
Deploy a white-label AMM DEX on BNB Chain or Solana. Your brand, your fees, your liquidity pools — live in 24 hours.
Get Your AMM DEX → Free Setup →