h hoge.gg
Subscribe
BTC$67,432.18+2.34%ETH$3,521.44+1.08%SOL$178.62-0.62%BNB$612.30+0.41%XRP$0.6234-0.18%ADA$0.4521+3.12%DOGE$0.1623+1.86%AVAX$38.71-1.24%LINK$17.84+0.92%HOGE$0.00004120+4.21%
BTC$67,432.18+2.34%ETH$3,521.44+1.08%SOL$178.62-0.62%BNB$612.30+0.41%XRP$0.6234-0.18%ADA$0.4521+3.12%DOGE$0.1623+1.86%AVAX$38.71-1.24%LINK$17.84+0.92%HOGE$0.00004120+4.21%
● DeFi & On-chain

AMM Design Explained: How Automated Market Makers Work

Automated market makers turned a Reddit idea into DeFi's core trading engine. Here is how AMM design works, from constant-product math to hooks, LVR, and the fixes reshaping it in 2026.

Every time someone swaps a token on Uniswap, Curve, or PancakeSwap, they trade against a piece of code, not a person. There is no bid, no ask, no market maker quoting a spread by hand. A formula sets the price, a shared pool of capital fills the order, and an algorithm rebalances the reserves inside the same block. That formula is the automated market maker, or AMM, and it is the single most consequential design in decentralized finance. In July 2026, decentralized exchange spot volume reached a record 24 percent of centralized exchange volume, the highest share since The Block began tracking the ratio in 2019, and almost all of that on-chain trading runs on some variant of the AMM. This guide walks through how AMM design actually works: the math, the tradeoffs, the ways liquidity providers quietly lose money, and the redesigns competing to fix it.

What an AMM is, and why it beat the order book

A traditional exchange runs a central limit order book: buyers post bids, sellers post asks, and a matching engine pairs them. That model is brutal to run on a blockchain. Every order placement and cancellation is a transaction that costs gas and waits for a block, so the fast, high-frequency quoting that keeps spreads tight simply does not fit. The first on-chain order books were slow and thin, and few tokens attracted enough professional market makers to trade cleanly.

The AMM throws the order book out. In its place sits a liquidity pool and a pricing function. Liquidity providers, or LPs, deposit two or more assets into a smart contract. Traders swap against that pool, and a deterministic formula, the invariant, sets the exchange rate for every trade. LPs earn a cut of each swap in fees. Nobody quotes a price; the curve does it automatically.

Two properties made this design win. The first is passive liquidity: an LP deposits once and the formula handles the rest, so anyone can become a market maker in a few clicks. That bootstrapped trading for thousands of long-tail tokens no professional desk would ever quote. The second is composability. A pool is a smart contract that other contracts can call, which is why AMMs sit underneath aggregators, structured products, and the DeFi lending markets that borrow their prices and liquidity. The catch, the thread running through everything below, is that the pool is always willing to trade at its formula price, which means it is always a step behind the real market, and somebody always profits from that lag.

From a Reddit post to trillions: the origin of the AMM

The AMM did not come from a trading firm. Ethereum co-founder Vitalik Buterin floated the idea of on-chain automated market makers in 2016 and 2017, then formalized the constant-product version in a March 2018 research note titled Improving front running resistance of x*y=k market makers. The title is telling. In the very post that popularized the formula, Buterin was already worried about front-running, the transaction-ordering problem the industry would later rebrand as MEV. The design carried its central flaw from birth. Buterin has since credited the specific constant-product formulation to the team at Gnosis rather than to himself.

Turning the idea into a product fell to Hayden Adams, a mechanical engineer who had just been laid off and taught himself Solidity to build something on Ethereum. He wrote a proof of concept in late 2017, won a grant from the Ethereum Foundation, and launched Uniswap V1 in November 2018. It supported only pools that paired a token with ETH, charged a flat 0.30 percent fee, and ran on the plainest possible version of the math.

From that seed, the design compounded. Version 2 added arbitrary token pairs and on-chain price feeds, version 3 introduced concentrated liquidity, and version 4 made pools programmable. Uniswap alone has since settled trillions of dollars in cumulative volume, according to DefiLlama, and a formula sketched to resist front-running now underpins the majority of on-chain trading.

Inside the constant product formula (x times y equals k)

The classic AMM holds two reserves: x units of one token and y units of another. Its rule is a single equation, x multiplied by y equals a constant k. Every trade must leave that product unchanged, before fees. The price the pool quotes is just the ratio of the reserves. A pool holding 100 ETH and 300,000 USDC prices ETH at 3,000 USDC, because 300,000 divided by 100 is 3,000.

Now buy ETH from that pool. To take ETH out you must put USDC in, and the product of the new reserves has to stay at k, which here is 30,000,000. Buy 10 ETH and the ETH reserve falls to 90, so the USDC reserve must rise to 30,000,000 divided by 90, about 333,333. You pay roughly 33,333 USDC for 10 ETH, an average price near 3,333 rather than the 3,000 you saw before you traded. That gap is price impact, and it is baked into the curve: the more you buy, the worse your average fill.

The shape of the curve, a hyperbola, guarantees the pool can never be fully drained. As one reserve approaches zero its price approaches infinity, so the last units are effectively unbuyable. The pool offers infinite liquidity, but at a steeply rising price. Fees are the LP’s reward for providing it: Uniswap V2 adds its 0.30 percent to the reserves on every swap, so k creeps upward over time and each LP’s share of the pool is worth a little more. Those fees are the only revenue an LP earns, and, as the next sections show, the only thing standing between an LP and a steady bleed.

Slippage, price impact, and the arbitrage that keeps prices honest

Two terms get muddled here. Price impact is the move your own trade causes as it slides along the curve. Slippage is the broader gap between the price you expected and the price you got, which includes your impact plus any change in the pool between the moment you signed and the moment your transaction landed. Traders set a slippage tolerance to cap that gap; set it too tight and the trade reverts, too loose and you invite the sandwich attacks described later.

Depth is the antidote to impact. The larger a pool’s reserves, the smaller the proportional change any single trade makes, so a 10 ETH buy barely moves a pool with 10,000 ETH but wrecks a pool with 100. This is why total value locked matters beyond bragging rights: it is a direct measure of how much size a venue can absorb without punishing the trader.

What keeps a pool’s price aligned with the wider market is arbitrage. If ETH trades at 3,100 USDC on Coinbase while the pool still says 3,000, an arbitrageur buys the cheap ETH from the pool until its price climbs to 3,100. The pool stays honest, but the arbitrageur’s profit comes straight out of the LPs, who sold ETH too cheap. That transfer is the seed of both impermanent loss and loss-versus-rebalancing. A passive pool always quotes a slightly stale price, and better-informed traders exist precisely to pick off stale prices. Economists call it adverse selection, and it is the structural tax of being an AMM.

Beyond constant product: StableSwap, weighted, and concentrated pools

Constant product is wonderfully general and badly inefficient. It spreads liquidity evenly across every price from zero to infinity, even though a USDC/USDT pair will realistically only ever trade within a fraction of a cent of parity. A series of designs kept the AMM idea but reshaped the curve for specific jobs.

Curve’s StableSwap, introduced in Michael Egorov’s 2019 StableSwap whitepaper, targets assets that should trade near parity, such as USDC and USDT or stETH and ETH. It blends a constant-sum curve, which offers zero slippage but can be drained to empty, with the constant-product curve, tuned by an amplification coefficient A. Near the peg the pool behaves almost like constant sum, giving traders very deep, low-slippage swaps; far from the peg it reverts to constant product so it can never be fully emptied. The result is the deepest stablecoin liquidity in DeFi, at the cost of assuming the peg holds.

Balancer generalized the formula in another direction. Its 2019 whitepaper describes an n-dimensional invariant that supports pools of many tokens with arbitrary weights, an 80/20 split or an eight-asset index, so a pool behaves like a self-balancing portfolio that continuously rebalances toward its target weights. Uniswap V3 pushed capital efficiency instead: LPs concentrate their liquidity inside a chosen price range rather than spreading it across the entire curve, which the V3 announcement pegged at up to 4,000 times more capital-efficient than V2. DODO took yet another path with its proactive market maker, which uses an external oracle to shift the curve so liquidity clusters around the live market price, mimicking an order book. The table below sorts the main families.

DesignCore mechanismBest suited forMain tradeoffExample
Constant productx times y equals kAny pair, long-tail tokensLiquidity spread thin, high slippageUniswap V2
StableSwapConstant sum blended with constant productPegged or correlated assetsA depeg breaks the assumptionCurve
Weightedn-dimensional invariantIndex and portfolio poolsSame impermanent loss and LVR exposureBalancer
Concentrated liquidityConstant product within a chosen rangeActive LPs, deep pairsOut-of-range positions earn nothingUniswap V3
Proactive (PMM)Oracle-shifted curveOrder-book-style pricingDepends on an external oracleDODO
Function-maximizingBatch clearing at a uniform priceCutting LVR and MEVNeeds solver infrastructureCoW AMM

The Uniswap ladder: V1 through V4

Because Uniswap set the template, its four versions double as a history of AMM design. Each release solved the pain point the last one exposed.

V1 proved the concept with ETH-only pairs and a flat fee. V2, in May 2020, let any two ERC-20 tokens pair directly and added time-weighted price oracles that other protocols could read, a feature that turned Uniswap into critical infrastructure well beyond trading. V3, in May 2021, introduced concentrated liquidity and split fees into tiers, turning passive LPs into active range managers and representing each position as an NFT rather than a fungible token. V4, live since 31 January 2025, is the biggest architectural change: it introduced hooks, plus a single contract that holds every pool and a flash-accounting system that nets balances at the end of a transaction, cutting the gas cost of creating and routing through pools dramatically. Each fee tier and lifecycle detail is spelled out in Uniswap’s release notes.

VersionLaunchedHeadline innovationFee model
V1Nov 2018ETH-paired pools on x times y equals kFlat 0.30%
V2May 2020Any ERC-20 pair, on-chain TWAP oracleFlat 0.30%
V3May 2021Concentrated liquidity, LP positions as NFTsTiers: 0.05%, 0.30%, 1.00%
V4Jan 2025Hooks, singleton pool contract, flash accountingCustom or dynamic per pool

Impermanent loss: the tax every liquidity provider pays

The first cost every LP meets is impermanent loss, also called divergence loss. It measures how much worse off an LP is compared with simply holding the two deposited assets, once their price ratio has moved. The mechanism is the arbitrage from earlier, seen from the LP’s side: as ETH rises, arbitrageurs buy the cheap ETH out of the pool, so the LP is left holding more of the token that lagged and less of the token that ran. The pool rebalances automatically, and it always rebalances you onto the wrong side of the move.

The loss depends only on the size of the price change, not its direction, so a 2x rise and a halving produce identical drag. Binance Academy lays out the standard curve, which falls straight out of the constant-product math and is reproduced below. A doubling in relative price costs an LP about 5.7 percent versus holding, before fees.

Price change vs entryImpermanent loss vs holding
1.25x0.6%
1.5x2.0%
2x5.7%
3x13.4%
4x20.0%
5x25.5%

It is called impermanent because if the price ratio returns to where the LP entered, the loss disappears. If the ratio never comes back, the loss becomes permanent the moment the LP withdraws. This is the core LP calculation: fee income has to outrun divergence loss for providing liquidity to beat just holding the tokens, which is why volatile, low-volume pairs are so often a losing trade for passive LPs.

Loss-versus-rebalancing: the cost that reframed AMM design

Impermanent loss compares an LP to a buy-and-hold investor, but that is not the right benchmark for a market maker. A professional could have hedged the price exposure and still collected the spread, so the sharper question is how the pool performs against a strategy that carries the same market exposure but trades at true market prices. In 2022, researchers Jason Milionis, Ciamac Moallemi, Tim Roughgarden, and Anthony Lee Zhang answered it with a metric they named loss-versus-rebalancing, or LVR, pronounced lever.

LVR isolates the pure adverse-selection cost: the money LPs lose to arbitrageurs who trade against a stale pool price, stripped of general market direction. In an explainer of the paper, the authors put a concrete number on it. A Uniswap V2 ETH-USDC pool with 5 percent daily volatility loses roughly 3.125 basis points per day to LVR, which compounds to about 11 percent a year. That is the structural cost of passive liquidity, and fees have to cover it. As the researchers put it, an AMM can only succeed if it has happy LPs, which means fee revenue needs to scale with LVR.

The idea reframed the field. Roughgarden, a Columbia computer scientist who also heads research at a16z crypto, and his co-authors turned a vague sense that pools leak value into a precise, hedged, closed-form quantity. Once LVR could be measured, it could be targeted, and a wave of new designs set out to capture it, auction it, or engineer it away.

MEV, sandwiches, and the war for orderflow

Arbitrage is the polite way LPs lose money. The rougher way is MEV, or maximal extractable value, the profit that whoever orders transactions in a block can extract by inserting, reordering, or dropping trades. AMMs are the richest hunting ground for it because their prices move predictably with each trade.

The signature attack is the sandwich. A searcher spots your swap sitting in the public mempool, buys the same asset just ahead of you to push the pool price up, lets your trade execute at that inflated price, then sells right after. Your slippage becomes their profit, and you never see the counterparty. A subtler drain is just-in-time, or JIT, liquidity: a sophisticated LP adds a large concentrated position one block before a big swap and pulls it immediately after, skimming most of the fee while the passive LPs who sat in the pool all day get diluted.

All of this ties AMMs to the block-production supply chain, where searchers bundle profitable trades, builders assemble the most valuable block, and proposers sell the right to build it. The question of who actually assembles a block, which we examined on the Bitcoin side in our look at mining pools and block construction, is exactly what determines who captures MEV on Ethereum. The defenses are now an industry of their own: private order flow that skips the public mempool, rebate schemes that hand part of the MEV back to users, tight slippage limits, and batch auctions that settle many trades at one price so there is nothing to front-run.

AMMs as price oracles, and how the feed gets gamed

Because an AMM publishes a live, on-chain price, other contracts read it as an oracle. That is convenient and dangerous. A spot pool price can be shoved around within a single block: an attacker takes a flash loan, trades hard against a thin pool to distort its price, exploits a downstream lending market or derivatives contract that trusts that price, and repays the loan, all atomically. A long list of DeFi exploits reduces to a protocol trusting a manipulable pool quote.

Uniswap V2 introduced the time-weighted average price, or TWAP, specifically to raise that cost. By averaging the price over a window of blocks, TWAP forces an attacker to hold a distorted price across many blocks rather than one, which is far more expensive and exposes them to arbitrage the whole time. It is not a cure. TWAP lags real moves, and on shallow pools or short windows it can still be pushed. Through 2026 the more advanced attacks have moved up the stack to target the reporting feeds themselves, a shift we traced in oracle manipulation in 2026. The working rule for builders is blunt: an AMM is an excellent venue for price discovery and a risky single source of price truth, so serious protocols lean on dedicated oracle networks and treat a pool’s TWAP as a sanity check rather than gospel.

Redesigning the AMM: dynamic fees, auctions, and CoW’s function-maximizing model

If LVR is the disease, three families of cures are competing. The first is dynamic fees. Since LVR spikes exactly when volatility spikes, a pool can raise its fee when markets move fast and cut it when they are calm, so fee income tracks the adverse selection it needs to offset. Programmable fees are one of the headline uses of Uniswap V4 hooks.

The second family auctions off the arbitrage. Rather than letting whoever is fastest keep the LVR, these designs sell the right to make the first trade against a pool each block and route the proceeds back to LPs, converting a leak into revenue. The third and most radical family changes how trades clear. CoW Protocol’s function-maximizing AMM batches trades and settles them at a single uniform clearing price. Solvers compete for the right to trade against the pool, and, as the protocol documentation explains, the winning solver is the one that moves the pool furthest in the LPs’ favor. Because the pool only ever trades at that batch equilibrium price, the arbitrage profit that would have been LVR is competed away and returned to LPs, and sandwich attacks disappear because there is no in-block price to front-run. The design runs live on Balancer pools.

Not everyone thinks the base design is broken. Uniswap founder Hayden Adams has pushed back hard on the argument that AMMs are structurally unsustainable, writing that “AMMs are only just getting started.” He contends that cheaper capital and composability let pools outprice professional firms in low-volatility pairs like stablecoins, that AMMs are often the only structure that scales for volatile long-tail tokens, and that v4 hooks will let builders design pools that capture more value for LPs rather than bleeding it to arbitrageurs.

Hooks, intents, and the road beyond the pool

Hooks turn a pool from a fixed formula into a platform. A V4 hook is a contract the pool calls at set moments, before or after a swap, or when liquidity is added or removed, so a single pool can run dynamic fees, on-chain limit orders, a time-weighted average market maker for splitting large orders across blocks, a custom oracle, or gated access for tokenized equities. The Uniswap Foundation has backed a marketplace and liquidity incentives to seed useful hooks, and the design intent is that most future AMM innovation ships as a hook rather than as a whole new protocol.

The bigger shift is happening one layer up, in how orders reach pools at all. In the intent model a user does not pick a route; they sign a statement of what they want, such as the best possible price for selling a token, and a competitive network of solvers finds the execution, often matching orders against each other peer-to-peer before touching any pool. CoW Protocol, UniswapX, and 1inch Fusion all work this way. Account abstraction makes it smoother: as wallets adopt smart-account features, a theme we covered in EIP-7702 in the wild, a user can sign one intent and let a solver execute a complex multi-step swap in a single click. The pool is quietly becoming one liquidity source among many, wrapped in an execution layer that decides when to use it. AMMs are not vanishing; they are being abstracted behind solvers.

Where US regulators landed

For years the unanswered question was whether building or running an AMM is a regulated activity in the United States. Under former chair Gary Gensler, the SEC issued Uniswap Labs a Wells notice in 2024, signaling it might sue the company for operating as an unregistered securities broker and exchange and for offering unregistered securities. The case looked like a defining test for DeFi.

It fizzled. In February 2025, under new leadership including Acting Chair Mark Uyeda and Commissioner Hester Peirce, the SEC closed the investigation with no enforcement action. The relief is real but narrow. Dropping one probe did not settle whether an AMM front end, the underlying protocol, or an individual LP counts as a broker or exchange under US law; it simply removed the immediate threat. The durable answer will come from market-structure legislation rather than from a single enforcement decision, one of many crypto policy deadlines tracked in our regulatory countdown. It is also worth separating the pieces regulators actually reach: Uniswap Labs the company, which builds the popular front end, is distinct from the immutable Uniswap contracts and the UNI governance token, and enforcement has consistently aimed at the identifiable company and interface, not the code.

The state of AMMs in 2026

On-chain trading has never been a larger part of the market. DEX spot volume closed July 2026 at a record 24 percent of centralized exchange volume, up from about 17 percent a year earlier, per The Block. Part of that record came from falling centralized volume rather than a surge on-chain, but the multi-year trend is structural: better aggregation and faster cross-chain execution have made on-chain swaps a close substitute for a centralized order book on many pairs.

Uniswap still leads the field by volume and carries billions of dollars in liquidity across its versions, according to DefiLlama, with Curve dominant in stablecoins, PancakeSwap heavy on BNB Chain, and Aerodrome anchoring Base. Solana, Base, and BNB Chain are doing much of the heavy lifting in raw volume. Not every venue is an AMM: order-book DEXs like Hyperliquid have taken real share in perpetual futures, a reminder that the AMM won spot trading, not everything. Within Uniswap, V4 has drawn billions in liquidity and a growing share of Ethereum mainnet volume in its first year as hooks pools proliferate.

The direction of travel is clear. The frontier of AMM design is now LVR-aware pricing through dynamic fees and auctions, function-maximizing pools that neutralize arbitrage, intent-based routing that hides the pool behind a solver, and programmable hooks that let a pool behave like whatever its creator needs. The on-chain order book is not coming back to displace the AMM; instead the AMM is absorbing the order book’s best ideas while keeping the passive, permissionless liquidity that made it win in the first place.

Frequently Asked Questions

What is an automated market maker in simple terms?

An automated market maker is a smart contract that lets people trade tokens against a shared pool of capital instead of matching them with other traders through an order book. A fixed formula sets the price from the pool’s reserves, liquidity providers supply the assets and earn a share of trading fees, and the whole process runs automatically on-chain with no human market maker involved.

What is the difference between impermanent loss and loss-versus-rebalancing?

Impermanent loss measures how much worse a liquidity provider does than if they had simply held the two tokens, and it depends only on how far the price ratio moves. Loss-versus-rebalancing, or LVR, compares the pool to a hedged strategy that trades the same amounts at true market prices, isolating the money lost to arbitrageurs picking off the pool’s stale price. LVR is the cleaner measure of the structural cost of running an AMM.

Do liquidity providers actually make money?

Only when the fees and incentives they collect exceed their impermanent loss and LVR. In deep, high-volume pools of correlated assets such as major stablecoin pairs, fee income usually wins and providing liquidity is profitable. In volatile, low-volume pairs the losses to arbitrage often outrun the fees, which is why passive liquidity provision on speculative tokens is frequently a losing trade once you account for divergence loss.

What are Uniswap v4 hooks?

Hooks are plug-in contracts that run custom logic at set points in a Uniswap V4 pool’s life, such as before or after a swap or when liquidity changes. They let a single pool add features like dynamic fees, on-chain limit orders, custom oracles, or gated access without launching a new protocol, turning the AMM into a programmable platform.

Are AMMs legal to use in the United States?

Using an AMM is not illegal, and in February 2025 the SEC closed its investigation into Uniswap Labs without any enforcement action. That decision removed an immediate threat but did not set a rule, so the legal status of AMM front ends, protocols, and liquidity providers remains unsettled and is expected to be resolved by future market-structure legislation rather than by that single case.

By the HOGE Wire markets desk, covering DeFi market structure and on-chain trading infrastructure.

Share 𝕏 Post Telegram