Uniswap AMM Calculator
Calculate swap prices, slippage, and impermanent loss for Uniswap V2/V3/V4 pools
1. What is Uniswap AMM?
Uniswap is an Automated Market Maker (AMM) that enables decentralized token swaps using liquidity pools instead of order books. Users trade against pools of tokens, and prices are determined algorithmically based on the ratio of tokens in the pool.
2. How does it work?
Uniswap V2 uses the constant product formula (x * y = k), where x and y are the reserve amounts of two tokens. When you swap, the product remains constant, automatically adjusting prices based on supply and demand. V3 introduced concentrated liquidity for better capital efficiency, and V4 added customizable hooks.
Understanding Price Impact
Price impact is the difference between the market price and the estimated execution price due to trade size. Larger trades relative to pool size result in higher price impact.
Impermanent Loss
Impermanent Loss occurs when the price ratio of tokens in a liquidity pool changes. The loss is 'impermanent' because it only becomes permanent when you withdraw liquidity.
3. Examples
V2: USDC/ETH Pool
Reserve0: 45000000 USDC, Reserve1: 15000 ETH
Swap 100000 USDC with 0.3% fee
(typical V2 pool state)V2/V3: DAI/USDC Stable Pair
Reserve0: 25000000 DAI, Reserve1: 25000000 USDC
Swap 50000 DAI with minimal slippage
(0.01% fee on V3, 0.3% on V2)V3: WETH/USDT Concentrated Liquidity
Reserve0: 8000 WETH, Reserve1: 28000000 USDT
Swap 50 WETH (~0.6% of pool)
V3 allows liquidity concentration for better capital efficiency