AMM Math: Constant Product, StableSwap, Concentrated Liquidity
How x·y=k, Curve's StableSwap invariant, and Uniswap V3/V4 ticks actually price trades — and why each design exists.
40 min · advanced · part of DeFi Deep Dive: Lending, AMMs & Yield
What you'll learn
- From Order Books to Curves
- Constant Product: x · y = k
- StableSwap: Curve's Hybrid Invariant
- Uniswap V3: Concentrated Liquidity and Ticks
- Uniswap V4: Hooks and the DEX Landscape
- What to Remember
Key terms
- AMM (Automated Market Maker)
- A smart contract that holds reserves of multiple assets and uses a deterministic pricing function (invariant) to allow swaps without an order book.
- Constant-product invariant
- The pricing function x · y = k used by Uniswap V1 and V2. Reserves of two assets multiply to a constant; the curve is a hyperbola.
- StableSwap invariant
- Curve's hybrid pricing function that behaves like constant-sum near the peg (low slippage) and transitions to constant-product as the pool becomes imbalanced. Designed for pegged or highly correlated assets.
- Amplification coefficient (A)
- A parameter in Curve's StableSwap that controls how flat the curve is around the peg. Higher A means lower slippage but greater vulnerability to depeg events.
- Concentrated liquidity
- A Uniswap V3/V4 feature where LPs allocate capital only to a specific price range. In-range capital is dramatically more efficient; out-of-range capital earns nothing.
- Tick
- A discrete price increment (0.01% / 1 basis point) used by Uniswap V3 and V4 to discretize the price space and make concentrated liquidity computable on-chain.
- Fee tier
- A configurable swap fee level (0.01%, 0.05%, 0.30%, 1.00% in standard Uniswap V3) chosen per pool. LPs and traders self-sort across tiers based on volatility and trade size.
- Hook (Uniswap V4)
- A smart contract attached to a V4 pool that runs custom logic at lifecycle events (before/after swap, on position change, on initialization). Enables dynamic fees, limit orders, custom MEV protection, and more.
- Singleton architecture
- Uniswap V4's design where one contract holds the state of all pools, dramatically reducing gas costs for multi-hop swaps and pool creation versus V3.
- Curve Wars
- The competitive bribing of veCRV holders (and later Convex/Aura holders) to direct CRV emissions toward specific pools. A central economic game in DeFi 2021-2024 and still relevant in muted form.
Read the full lesson in the CryptoBipto app.
Open lessonEducational only — not financial advice.
