Uniswap AMM Constant Product Curve v2

Interactive visualization of x × y = k using real ETH/USDC pool data

Where:

  • x = Reserve of ETH
    • currently 100 ETH
  • y = Reserve of USDC
    • currently 200,000 USDC
  • k = Constant product
    • 20,000,000
x × y = k

Constant Product Formula

Key Insights:

  • 📈 Price = y/x ratio
  • 🔄 Trading moves along curve
  • 💧 Liquidity changes k value
  • Slippage from curve shape

Control Panel

20,000,000
100 ETH, 200,000 USDC
100×200,000=20,000,000 ✓
1 ETH = 2,000 USDC

AMM Curve Evolution

🔄 Trading

📚 Trading: Buy/sell ETH while k stays constant. Price changes based on new ratio.

💰 Liquidity

📚 Liquidity: Add/remove both tokens proportionally. Changes k value and curve position.
Choose an action above to see how it affects the AMM curve.

Real Example: ETH/USDC Pool

Current liquidity pool state:

  • 100 ETH (Token A)
  • 200,000 USDC (Token B)
  • k = 20,000,000 (100 × 200,000)

The price of 1 ETH = 200,000/100 = 2,000 USDC

💡 Key Learning Points:

  • Trading: Moves along the existing curve (k constant), changes price
  • Adding Liquidity: Creates a new curve with higher k, more liquidity
  • Removing Liquidity: Creates a new curve with lower k, less liquidity
  • Price Impact: Large trades cause bigger price changes due to the curve's shape
  • Slippage: The difference between expected and actual trade prices