DeFi · Intermediate

How AMMs Work: Uniswap, Liquidity Pools & Impermanent Loss

April 25, 20269 min readpoly-sim.com

Automated Market Makers (AMMs) are the engine of decentralised trading. Instead of matching buyers with sellers via an order book, AMMs use a mathematical formula and liquidity pools to enable 24/7 trading of any token pair. Understanding AMMs explains how Polymarket prices YES/NO contracts and why prediction market spreads exist.

The Core AMM Concept

In a traditional exchange order book, someone must be willing to sell for you to buy. AMMs solve this by using liquidity pools: reserves of two tokens held in a smart contract. When you trade, you swap one token from the pool for another. The price adjusts automatically based on the ratio of tokens in the pool.

The Constant Product Formula (x × y = k)

Uniswap v2 Invariant
x × y = k

x = amount of token A in pool; y = amount of token B in pool; k = constant. When you add token A, you receive token B, but the product must remain k. This mathematically ensures the pool never runs out of either token (at increasingly unfavorable prices for large trades).

Example: ETH/USDC pool with 100 ETH and $200,000 USDC. k = 20,000,000. Price = 200,000/100 = $2,000/ETH. If you buy 10 ETH: new ETH = 90, new USDC = 20,000,000/90 = $222,222. Price paid = 22,222/10 = $2,222 average. The price "slipped" from $2,000 to $2,222 due to pool impact.

Impermanent Loss: The LP's Dilemma

If you provide liquidity to a pool and the price of one token changes significantly, you end up with less of the appreciating token than if you'd just held. This "impermanent loss" is only crystallised when you withdraw — hence "impermanent." But if the price doesn't revert, the loss becomes permanent.

Rule of thumb: providing liquidity to correlated asset pairs (e.g., ETH/stETH) minimises impermanent loss. Providing to volatile/uncorrelated pairs (e.g., ETH/SHIB) maximises it. LP fees must compensate for impermanent loss to make providing liquidity profitable.

💡 AMMs on Polymarket

Polymarket uses an AMM-style pricing mechanism for its YES/NO contracts. The price you see (e.g., YES at 65¢) is determined by the current liquidity pool composition. Large trades move the price more than small ones — this "market impact" creates spread, which is why a sharp trader with a small edge should trade small positions rather than size up and destroy their own edge through price impact.

🔐
Access DeFi AMMs Safely with Ledger
Connect Ledger to MetaMask to interact with Uniswap, Curve, and other AMMs while keeping keys secure.
Shop Ledger →
← What Is DeFi? Yield Farming → All DeFi Articles
🎯
Trade Prediction Markets Powered by AMM Logic
Polymarket uses automated market-making for its order book — your AMM knowledge gives you a real edge.
Open Polymarket →