For educational purposes only; not investment advice. AMM swaps and liquidity positions can incur slippage, MEV, contract loss and underperformance versus holding.
Direct answer
An automated market maker is a family of on-chain exchange mechanisms that quote and settle trades against pooled assets under a rule or curve. Constant-product, weighted, stable-swap, concentrated-liquidity and hook-based designs have different invariants, fees and risks; AMM is not synonymous with x*y=k or with every decentralized exchange.
For a swap, distinguish pre-trade marginal price, average execution price, deterministic price impact and pending-time slippage. For a liquidity position, reconcile deposited inventory, pool shares or range liquidity, fees, incentives, gas and withdrawal proceeds against the same-assets hold benchmark.
- Price impact including fee
- 9.34%
- Input-side fee
- 0.03
Outputs are educational approximations. They exclude venue rules, taxes, latency, oracle behavior, and other protocol-specific parameters unless shown.
How it works
- Pin the chain, pool and router addresses, implementation version, token ordering and decimals, curve or invariant, fee tier, protocol fee, hooks, administrators and pause controls.
- Normalize raw balances and internal reserves; define asset-in, asset-out and price units. Verify whether donations, rebases or transfer fees make balances differ from accounting reserves.
- Reproduce the exact-input or exact-output quote for every route hop, including fee, invariant, rounding, reserve update, marginal price, average execution, price impact,
minOutand deadline. - Simulate the calldata, approvals, native value and route against a declared block; stress state drift, MEV, gas, reverts and alternative liquidity before signing.
- For LPs, reconcile deposits, minted shares or liquidity, active range, fee ownership, incentives, withdrawals, rounding and any lock or pause.
- Compare terminal LP wealth with a matched hold benchmark, separating inventory value, fees, sold rewards, gas, tax, impermanent loss, adverse selection and rebalancing.
- Verify receipts, balance deltas and allowances; monitor curve, fee, hooks, reserves, concentration, oracle use, upgrades, range status, migrations and exit limits.
Examples
- A constant-product pool has
x=100 ETH,y=200,000 USDCandk=20,000,000. Buying exactly 10 ETH without a fee requires200000*10/90 = 22,222.222222 USDC; with a 0.30% input fee it requires200000*10/(90*0.997) = 22,289.089491 USDC, averaging2,228.908949 USDC/ETH. The post-trade reserve ratio is222289.089491/90 = 2,469.878772 USDC/ETH. - The same pool has 1,000 LP tokens. A proportional deposit of 10 ETH and 20,000 USDC mints
100 LP tokens, giving100/1100 = 9.0909090909%. If reserves later become 120 ETH and 264,000 USDC, that share withdraws10.9090909091 ETHand24,000 USDC, before burn fees and rounding. - An LP starts with 10 ETH and 20,000 USDC at 2,000; ETH rises to 3,200, so price ratio is
r=1.6. Full-range constant-product value relative to holding is2*sqrt(1.6)/(1+1.6)=0.9730085108, or-2.6991489179%; a 52,000-USDC hold benchmark corresponds to50,596.442563 USDCbefore fees. - Concentrated liquidity has
L=1,000, rangePA=1toPB=9, and currentP=4. It holds166.6666666667token0 and1,000token1, worth1,666.6666666667in token1 units. AtP>=9, it holds zero token0 and2,000token1 and earns no active-range swap fees while price remains outside.
Risks
- The curve or AMM model is identified incorrectly.
- Token order, price direction or decimals invert the quote.
- Balances, reserves or the simulated block are stale.
- Fee tier or protocol fee changes the invariant update.
- Thin liquidity creates large deterministic price impact.
- Slippage tolerance or
minOutpermits an unacceptable fill. - A sandwich or other MEV strategy extracts value.
- A multihop router or intermediate pool fails.
- LP shares are diluted or reserve donations distort accounting.
- Impermanent loss exceeds fees and rewards.
- Concentrated liquidity becomes inactive outside its range.
- Rebalancing, gas and taxes consume range returns.
- Fees or incentives are double counted in LP performance.
- Reward tokens fall, unlock or cannot be sold.
- Fee-on-transfer, rebasing, callbacks or hooks break assumptions.
- A manipulable AMM spot price is used as an oracle.
- A contract bug, reentrancy or accounting error loses assets.
- Admin, upgrade, pause, governance or hook powers change behavior.
- Bridge, custodian, frontend or RPC compromise redirects execution.
- Chain congestion, reorg, failed withdrawal or recordkeeping errors block exit.
Common misconceptions
- Every AMM uses
x*y=k. Stable, weighted, concentrated and custom curves differ. - The pool spot is the external fair price. Arbitrage only tends to align prices subject to fees, depth, latency and risk.
- Slippage and price impact are identical. Price impact follows the trade size; slippage also captures movement between quote and execution.
- Fees guarantee that LPs beat holding. Inventory loss and adverse selection can exceed fee income.
- Impermanent loss harmlessly disappears if one waits. It is benchmark-relative underperformance and can persist or become realized on exit.
Related topics
Sources
- Uniswap v2 Core - Uniswap Labs (accessed: 2026-08-13)
- Uniswap v3 Core - Uniswap Labs (accessed: 2026-08-13)
- How Uniswap Works - Uniswap Labs (accessed: 2026-08-13)
- Swaps - Uniswap Labs (accessed: 2026-08-13)
- Fees - Uniswap Labs (accessed: 2026-08-13)
- StableSwap - efficient mechanism for Stablecoin liquidity - Curve Finance (accessed: 2026-08-13)
- Balancer Whitepaper - Balancer (accessed: 2026-08-13)
- DeFi risks and the decentralisation illusion - Bank for International Settlements (accessed: 2026-08-13)