🔄 AMM Pools: How Uniswap Works
Learn automated market making and the constant product formula
Your Progress
0 / 5 completed💱 What is an Automated Market Maker?
Automated Market Makers (AMMs) are smart contracts that create liquidity pools and enable users to trade cryptocurrencies without traditional order books. They use mathematical formulas to price assets automatically based on supply and demand.
Why AMMs Matter in DeFi
Constant Liquidity
Trade anytime, 24/7, without needing a counterparty. Liquidity is always available through the pool.
Permissionless
Anyone can create a trading pair, provide liquidity, or swap tokens without approval from a central authority.
Automated Pricing
Prices adjust automatically based on trades. No manual price setting or order matching required.
🔍 Interactive: Liquidity Pool States
Explore how liquidity pools behave in different scenarios:
Balanced Pool
When both tokens have equal value in the pool, the exchange rate is 1:1.
Key Insight:
This is the ideal state where the AMM offers fair prices with minimal slippage.
How AMMs Differ from Order Books
Traditional Order Book
Buyers and sellers post orders at specific prices. Trades execute when buy and sell orders match.
AMM Liquidity Pool
Users trade directly against a smart contract pool. Prices determined by mathematical formula.
The Constant Product Formula
The magic behind AMMs is the constant product formula: x × y = k. When you trade, the product of the two token reserves must remain constant.
x = Token A reserves
y = Token B reserves
k = Constant product
Example: 100 × 100 = 10,000 (k stays constant)
Key Components of an AMM
| Component | Description | Role |
|---|---|---|
| Liquidity Pool | Smart contract holding token reserves | Enables trading |
| LP Tokens | Proof of ownership for liquidity providers | Track share of pool |
| Trading Fees | Small fee (e.g., 0.3%) on each trade | Reward LPs |
| Price Oracle | Pool ratio reflects market price | Price discovery |