DeFi Deep Dive: DEXs, AMMs, and Liquidity Pools
DEXs use automated market makers and liquidity pools to let anyone swap tokens peer-to-peer, with the x times y equals k formula setting prices without order books.
DeFi Deep Dive: DEXs, AMMs, and Liquidity Pools
A DEX lets you swap tokens directly from your wallet using liquidity pools and an automated market maker, with no exchange holding your funds and no order book to match.
If you have ever swapped a token on Uniswap, you have used a decentralized exchange (DEX) powered by an automated market maker (AMM). This guide unpacks how DEXs work, the math behind liquidity pools, the meaning of impermanent loss, and what beginners need to know before providing liquidity.
DEX vs CEX
A centralized exchange (CEX) like Binance or Coinbase matches buyers and sellers using an order book. The exchange holds your funds, requires KYC, and acts as the trusted middleman.
A decentralized exchange (DEX) has no order book and no custodian. Instead, it uses liquidity pools — token pairs locked in smart contracts — and a pricing algorithm to execute trades automatically. You trade against the pool, not against another person.
| Feature | CEX | DEX |
|---|---|---|
| Custody | Exchange holds funds | You hold your funds |
| Account | Email + KYC | Crypto wallet |
| Order matching | Order book | AMM / pool |
| Listing | Exchange decides | Often permissionless |
| Downtime | Exchange can halt | Always on |
| Privacy | Requires identity | Pseudonymous |
DEXs trade away speed and recoverability for self-custody and openness. For beginners, they are the gateway to the rest of DeFi.
What is an automated market maker (AMM)?
An AMM is a smart contract that prices trades algorithmically rather than matching orders. The most famous AMM is Uniswap, and its core idea is surprisingly simple.
Instead of buyers and sellers placing orders, the AMM holds a liquidity pool of two tokens — say ETH and USDC. A mathematical formula keeps the pool in balance and sets the price based on the ratio of the two tokens. The classic formula is:
x * y = k
Where:
- x = amount of token A in the pool (e.g., ETH)
- y = amount of token B in the pool (e.g., USDC)
- k = a constant
When you buy ETH from the pool, you add USDC and remove ETH. This changes the ratio, which moves the price. Buy enough, and the price rises steeply — this gap between expected and actual price is called slippage.
A useful analogy: imagine a seesaw. The two sides are the two tokens. When you take weight off one side and add to the other, the seesaw tilts (the price changes) until it balances again. Bigger pools tilt less for the same trade — that is why deep liquidity means less slippage.
Liquidity pools and LP tokens
A liquidity pool is funded by liquidity providers (LPs) — users who deposit equal dollar value of both tokens into the pool. In return, they receive LP tokens that represent their share of the pool. LPs earn a portion of every swap fee (commonly 0.05% to 1% per trade) proportional to their share.
For example, if you provide ETH and USDC to Uniswap's pool, you earn a cut of every ETH/USDC swap. Over time, those fees accumulate — this is the core yield of AMM liquidity provision.
Mainstream DEXs
| DEX | Specialty | Network |
|---|---|---|
| Uniswap | The original and largest AMM | Ethereum + L2s |
| Curve | Optimized for stablecoin and similar-asset swaps | Multi-chain |
| SushiSwap | Uniswap fork with extra features | Multi-chain |
| Balancer | Multi-token pools (more than two assets) | Ethereum + L2s |
| PancakeSwap | Leading DEX on BNB Chain | BNB Chain + others |
For beginners, Uniswap and Curve are the safest places to start because of their longevity, audit history, and deep liquidity.
How to provide liquidity
- Pick a pair you understand — ideally two assets you are comfortable holding long-term.
- Deposit equal dollar value of both tokens into the pool via the DEX interface.
- Receive LP tokens representing your share.
- Earn fees as swaps happen in the pool.
- Withdraw by returning your LP tokens; you get back your share of the pool plus accumulated fees.
Some pools also pay extra rewards in the protocol's governance token to attract liquidity. These "incentivized pools" offer higher yields but add token-price risk on top of normal LP risks.
Impermanent loss
The single most important concept for liquidity providers is impermanent loss (IL). When the price ratio of your two tokens changes, the pool automatically rebalances by selling the rising asset and buying the falling one. The result: you end up with more of the weaker asset and less of the stronger one than if you had simply held both tokens outside the pool.
- If prices return to their original ratio, IL disappears (hence "impermanent").
- If prices diverge permanently, IL becomes real and can outweigh trading-fee earnings.
- IL is worst for volatile pairs (e.g., ETH/memecoin) and minimal for stable pairs (e.g., USDC/USDT).
This is why Curve, which focuses on stable pairs, is popular with conservative LPs: little IL, modest but steady yield.
Risks of providing liquidity
- Impermanent loss — the silent killer of LP returns on volatile pairs.
- Smart contract risk — a bug in the DEX can drain the pool.
- Slippage for users — large trades on thin pools get bad prices.
- Token depeg — if one of your pool's tokens loses its peg (e.g., a stablecoin), losses can be severe.
- Incentive token risk — rewards paid in a governance token can collapse in value.
- Front-running and MEV — bots can profit by reordering your transactions, especially on Ethereum L1.
Bottom line
DEXs and AMMs are the engines of DeFi, letting anyone swap and provide liquidity without a middleman. For beginners, the rules are: start by swapping on Uniswap to learn the flow; only provide liquidity with assets you understand; prefer stable pairs if you want to minimize impermanent loss; and never assume high advertised yields are risk-free. The math is elegant, but the losses are real.
This article is for educational purposes only and does not constitute financial advice. Providing liquidity and using DEXs involve significant risk, including total loss of deposited funds; always do your own research and never deposit more than you can afford to lose.
Live Chart
Open full chart →Related market data, powered by TradingView.