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 in 2026: How Automated Market Makers Work

Automated market makers swapped the order book for a formula that sets every price, fee, and LP return. Here is how AMM design works, from x times y equals k to Uniswap V4 hooks.

Every time someone swaps one token for another on a decentralized exchange, no human market maker quotes a price and no order book pairs a buyer with a seller. A short piece of arithmetic does the job instead. That arithmetic is the automated market maker, or AMM, and its design decides how much slippage a trader pays, how much a liquidity provider earns, and how easily an arbitrage bot can empty the pool of value.

AMMs are the engine room of decentralized finance. They turned token trading from a matchmaking problem into a math problem, and in the process they let anyone list a market, supply liquidity, or trade at any hour without asking permission. The tradeoffs baked into each pricing formula are the reason a stablecoin swap can cost a fraction of a cent while a thin memecoin trade moves the price by double-digit percentages. This guide walks through how AMM design actually works, from the constant product formula that started it all to concentrated liquidity, hybrid curves, and the hook-driven pools that arrived with Uniswap V4.

What an automated market maker actually does

An AMM is a smart contract that holds a reserve of two or more tokens and quotes a price for swapping between them. The reserve is the liquidity pool, and it is funded by liquidity providers (LPs) who deposit tokens in exchange for a share of the pool and a cut of every trading fee. The price is not set by anyone; it is a function of the pool balances. When a trader buys one asset, that asset leaves the pool and the other enters, the balances shift, and the quoted price moves along a predefined curve.

This is a different animal from the central limit order book (CLOB) that runs every stock exchange and most centralized crypto venues. On an order book, market makers post individual bids and asks, cancel them when conditions change, and compete on price and speed. On an AMM, liquidity sits in the pool passively and quotes a continuous two-sided price at all times, with no cancellations and no active quoting. The pool is always willing to trade; the only question is at what price and how much slippage the trade incurs.

That passivity is the whole point. It means a market can exist for any token pair the moment someone seeds a pool, with no listing committee and no professional market maker required. For users, the upside is obvious: swap any token for any other in a single transaction, with no sign-up and no counterparty to vet. The friction lives elsewhere, in gas fees, in the price impact of large trades, and in the wallet experience that still trips up newcomers. Understanding where that price impact comes from means looking at the formula under the hood.

The constant product formula that started it all

The formula that defined the category is the constant product invariant, written as x times y equals k. Here x and y are the quantities of the two tokens in the pool and k is a constant that the contract holds fixed through every swap. The price of x in terms of y is simply the ratio y divided by x. Because the product must stay constant, buying x (shrinking x) forces y up and pushes the price of x higher with every unit bought. A trade never fully drains a pool, since taking the last unit would require an infinite amount of the other token; the curve only approaches the axes.

A worked example makes the mechanics concrete. Imagine a pool with 10 ETH and 20,000 USDC, so k is 200,000 and the starting price is 2,000 USDC per ETH. A trader who wants to buy 1 ETH leaves 9 ETH in the pool, so the USDC balance must rise to roughly 22,222 to keep the product at 200,000. The trader therefore pays about 2,222 USDC for that ETH, an average price well above 2,000 because the trade itself moved the market. The smaller the pool relative to the trade, the worse the slippage. Deep pools quote tight prices; shallow pools punish size.

The idea did not spring from one person. Alan Lu of Gnosis described a pool whose price came from the formula balance(A) times balance(B) equals k, and researchers including Martin Köppelmann and Vitalik Buterin pushed the concept forward. Buterin laid out the reasoning in a widely cited 2018 Ethereum Research post on improving the front-running resistance of x times y equals k market makers, which treated the constant product rule as a serious primitive rather than a curiosity. Hayden Adams turned it into shipping code with Uniswap V1 in November 2018, and the constant product pool has been the reference design ever since.

From order books to liquidity pools: a short history

The leap from theory to a market that people actually used happened fast. Bancor pioneered on-chain automated market making in 2017 with its bonding-curve smart tokens, but it was Uniswap V1 that made the constant product pool simple enough to catch on. Uniswap V2 arrived in May 2020 with two durable additions: direct ERC-20 to ERC-20 pairs (V1 routed everything through ETH) and time-weighted average price oracles that let other contracts read a manipulation-resistant price. The 2020 stretch that traders later called DeFi summer stacked new designs almost monthly, including the SushiSwap vampire attack that forked Uniswap and tried to drain its liquidity with token incentives.

Specialization followed. Curve focused on assets that trade near a fixed ratio, Balancer generalized the pool to many assets with custom weights, and Uniswap V3 reinvented how capital sits inside a pool. The latest chapter, Uniswap V4, turned the AMM into a programmable platform. Through all of it the center of gravity stayed with Uniswap, though its dominance has eroded as competitors and new chains multiplied; on November 9, 2026, DeFiLlama counted roughly 7.6 billion dollars in spot DEX volume over 24 hours, with Uniswap holding around a fifth of it, down from more than 60 percent at its peak. The table below sketches the milestones.

YearProtocol or eventWhy it mattered
2017BancorFirst widely known on-chain AMM using bonding curves
2018Uniswap V1Minimal constant product pools for ETH and ERC-20 tokens
2020Curve, BalancerStableSwap for pegged assets; weighted multi-asset pools
2020Uniswap V2Token-to-token pairs, TWAP oracles, flash swaps
2020SushiSwapFork plus liquidity incentives; the vampire attack
2021Uniswap V3Concentrated liquidity and multiple fee tiers
2022Loss-versus-rebalancing paperA rigorous measure of what LPs lose to arbitrage
2025Uniswap V4Hooks and a singleton contract turn the AMM into a platform

Impermanent loss: the cost of passive liquidity

Supplying liquidity is not free money. The headline risk is impermanent loss, sometimes called divergence loss, which is the gap between simply holding two tokens and depositing them into a constant product pool when their relative price moves. Because the pool always rebalances toward the cheaper asset, an LP ends up holding more of whatever fell and less of whatever rose, compared with a passive holder. The loss is called impermanent because it reverses if the price returns to where the LP entered; it becomes permanent only when the LP withdraws at a diverged price.

The size of the loss is pure geometry, and it is the same for any 50/50 constant product pool regardless of the tokens involved. The formula is two times the square root of the price ratio, divided by one plus that ratio, then minus one. What matters is that the loss grows with the square of divergence, so small moves barely register while large moves bite hard. The table shows the loss against holding for a range of price changes, assuming no fees are collected. Standard explainers of impermanent loss reproduce these same figures.

Price changeLoss versus holding
1.25xabout 0.6 percent
1.5xabout 2.0 percent
2xabout 5.7 percent
3xabout 13.4 percent
4xabout 20.0 percent
5xabout 25.5 percent

The practical takeaway is that fees have to outrun this curve. An LP in a busy, low-volatility pool can collect enough swap fees to stay ahead of impermanent loss; an LP in a volatile pair that trends hard in one direction often cannot. That is why stablecoin and pegged-asset pools, where prices barely diverge, attract so much passive capital, and why providing liquidity for a token that is about to double or halve can be a losing trade even when volume looks healthy.

Loss-versus-rebalancing: a sharper ruler

Impermanent loss has a weakness as a metric: it nets out to zero if the price round-trips back to the starting point, which flatters pools that mostly chop sideways. In 2022 a team of researchers proposed a cleaner measure. In their paper Automated Market Making and Loss-Versus-Rebalancing, Jason Milionis, Ciamac Moallemi, Tim Roughgarden, and Anthony Lee Zhang isolated the cost that LPs pay to better-informed traders, which they named loss-versus-rebalancing, or LVR (pronounced lever). It captures the money that arbitrageurs extract when a pool quotes a stale price and they correct it before the pool can react.

The intuition is that an AMM is always a step behind the real market. When the external price of ETH moves, the pool does not know until an arbitrageur trades against it, and that arbitrageur pockets the difference. LVR measures exactly that leakage by comparing the pool against a strategy that rebalances at true market prices. The authors derived closed-form expressions that work for any AMM, and for the constant product pool the rate of loss comes out proportional to the asset variance, roughly one eighth of the return variance per unit of time, the value they write as sigma squared over eight. Commentators have called the result a Black-Scholes formula for AMMs, because it ties LP returns to volatility the way options pricing does.

The reason LVR matters for design is that it reframes the LP problem. Impermanent loss can be hedged or waited out; LVR is a structural bleed to arbitrage that only disappears if the pool can quote fresher prices or charge fees that match volatility. Every serious AMM innovation since, from dynamic fees to auction-based order flow, can be read as an attempt to shrink LVR, and the metric has become the common language for comparing one pool design against another.

Bending the curve: Curve and StableSwap

Constant product works for any pair, but it is wasteful when the two assets are supposed to trade near a fixed ratio. Swapping USDC for USDT at a one-to-one peg should cost almost nothing, yet x times y equals k still charges meaningful slippage on size. Michael Egorov solved this in his 2019 StableSwap whitepaper with a hybrid invariant that blends two shapes: a constant sum curve (x plus y equals k), which quotes a perfectly flat one-to-one price but can be fully drained, and the constant product curve, which never runs out but charges slippage.

An amplification coefficient, written A, controls the blend. When A is large the pool behaves almost like constant sum near the peg, so stablecoin trades face tiny slippage; as the pool drifts away from balance, the curve bends back toward constant product to protect against one asset being bought out entirely. Curve launched this design in January 2020, and its three-pool of DAI, USDC, and USDT became a backbone of DeFi. These pools are the natural home for dollar stablecoins, whose US rulebook was finalized in 2026, because the whole point is to hold a peg.

StableSwap also powers a less obvious market: liquid staking tokens. A Curve pool is where stETH trades against ETH, and the depth of that pool is the mechanism that keeps the two close. When the design works, redemptions and arbitrage absorb selling without a cascade, which is why stETH held its peg through the last crash rather than spiraling. The catch is that the model assumes the peg holds; if an asset genuinely breaks from its reference, the flat part of the curve means LPs end up holding almost all of the broken asset before the pool can reprice.

Curve did not stop at pegged assets. A later design the project calls cryptoswap extended the same thinking to pairs that are not meant to hold a fixed ratio, such as ETH against a stablecoin, by letting the point of lowest slippage float with an internal price oracle rather than sitting fixed at one-to-one. The curve concentrates liquidity around the current market price and shifts that concentration as the price moves, which captures some of the efficiency of a hand-placed range without asking the LP to manage one. It is a reminder that the invariant and the way a pool tracks price are two separate design knobs, and that bending one can substitute for work on the other.

Weighting the pool: Balancer and constant-mean markets

Where Curve specialized downward toward a single ratio, Balancer generalized upward. Launched in March 2020 by Fernando Martinelli and Mike McDonald, Balancer replaced the fixed 50/50 split of a constant product pool with a constant-mean invariant, described in its whitepaper as the product of each balance raised to the power of its weight, held constant. In plain terms, a pool can hold up to eight assets in any proportion the creator chooses, and the formula keeps those value proportions fixed as prices move.

This makes a Balancer pool behave like a self-rebalancing index fund that pays the holder instead of charging a management fee. An 80/20 pool of a project token and ETH, for instance, keeps 80 percent of its value in the token and 20 percent in ETH, automatically selling into strength and buying into weakness as traders swap. The 80/20 shape has a practical appeal for projects: it bootstraps a liquid market while committing far less of the paired reserve asset, and it dampens impermanent loss relative to a 50/50 pool because less of the portfolio is exposed to the volatile leg.

The weighted model clarified something important about the whole category. Constant product, constant sum, and constant mean are all special cases of a broader family that academics call constant function market makers, where any invariant that is kept fixed through trades defines a valid pricing curve. Once builders saw the pattern, the design question shifted from which formula to use toward which shape fits a given market, and whether the shape can be changed on the fly.

Concentrated liquidity: Uniswap V3

The biggest efficiency jump came in May 2021 with Uniswap V3, which introduced concentrated liquidity. In V2, an LP spreads capital uniformly across every possible price from zero to infinity, even though almost all trading happens in a narrow band. V3 lets a provider concentrate capital inside a chosen price range, so the same dollar does far more work where it is actually needed. The protocol divides the price axis into discrete ticks, and an LP picks the two ticks that bound their position.

The headline number from the V3 whitepaper was up to 4,000 times the capital efficiency of V2 for a position squeezed into a single narrow range. In practice most LPs use wider ranges and capture a smaller multiple, but the gain is real, and it came with a tradeoff: a concentrated position earns nothing when the price leaves its range, so V3 liquidity requires active management. V3 also introduced multiple fee tiers, initially 0.05 percent, 0.30 percent, and 1 percent, with a 0.01 percent tier added later for stable pairs. Positions became non-fungible, represented as NFTs rather than fungible pool tokens, because each has its own range.

Did the extra complexity pay off? A study by Gordon Liao and Dan Robinson, The Dominance of Uniswap v3 Liquidity, found that V3 providers supplied more market depth near the current price with less total capital than V2 or centralized venues. The flip side is that concentrated liquidity rewards sophistication and invites strategies like just-in-time liquidity, where a bot adds a huge position moments before a large swap and removes it immediately after, collecting the fee while taking almost no price risk from passive LPs.

The management burden became a business of its own. Because a concentrated position stops earning the moment price leaves its range, active LPs have to rebalance, and a class of automated liquidity managers grew up to do that work for depositors who would rather not watch a chart all day. These vaults widen or recenter ranges on a schedule or in response to volatility, trading away a slice of the fees for convenience. The lesson that stuck is that capital efficiency and passivity pull in opposite directions; the more precisely a pool places its liquidity, the more someone has to tend it.

Hooks and the singleton: Uniswap V4

If V3 optimized the curve, V4 opened it up for customization. Deployed on January 31, 2025 across more than ten networks, Uniswap V4 keeps concentrated liquidity but wraps it in two structural changes. The first is a singleton: every pool now lives inside one contract rather than a separate contract per pair, and trades settle through a technique called flash accounting that nets balances at the end of a transaction. Uniswap estimates this cuts the gas cost of creating a pool by roughly 99 percent and makes multi-hop swaps dramatically cheaper.

The second change is hooks, and it is the one that matters most for design. A hook is a plug-in contract that runs custom logic at set points in a pool’s lifecycle, before and after a swap, or when liquidity is added or removed. That turns the AMM from a fixed formula into a platform. A hook can add capabilities that used to require a whole separate protocol:

  • Dynamic fees that rise and fall with volatility
  • On-chain limit orders that execute at a set price
  • Time-weighted average market makers that unwind a large position gradually
  • Custom price oracles built into the pool itself
  • Mechanisms that capture arbitrage value for LPs instead of leaking it

The upgrade shipped only after a long series of independent security audits and one of the largest bug bounties the industry had seen, a reflection of how much value a singleton concentrates in one place.

Hooks reframe the LVR problem as something a pool can fight directly. A pool that can read volatility and raise its fee in real time, or auction the right to trade first, can claw back some of what arbitrageurs would otherwise take. The open question is fragmentation: every hook is a new variation, and liquidity that scatters across hundreds of bespoke pools can be thinner and harder to route through than a few deep standard ones.

Five shapes, one table: the invariant zoo

It helps to see the main pricing curves side by side. Each is a constant function market maker; they differ only in which quantity they hold constant, and that single choice determines what the pool is good at and where it breaks. The table compares the five shapes that account for the overwhelming majority of on-chain liquidity today.

ModelInvariantBest forMain weakness
Constant sumx + y = kPerfect one-to-one swapsPool can be fully drained; no price discovery
Constant productx times y = kAny pair, always-on liquidityHigh slippage and impermanent loss
StableSwap (hybrid)Blends sum and product via AStablecoins and pegged assetsBreaks down if the peg breaks
Constant mean (weighted)Product of balances to their weights = kCustom multi-asset portfoliosStill exposed to divergence loss
Concentrated liquidityConstant product within a tick rangeCapital efficiency for active LPsEarns nothing out of range; needs management

No row is strictly better than the others. The right choice depends on how the two assets relate, how volatile they are, and how much work the LP is willing to do. A dollar stablecoin pair wants StableSwap; a brand-new token wants constant product so liquidity never runs dry; a professional LP with a view on range wants concentrated liquidity. Modern protocols increasingly let a single venue host all of these at once, which is precisely what V4 hooks make possible.

Fees, incentives, and the LP’s real return

An LP’s revenue is the swap fee, and the whole business works only if fees exceed the sum of impermanent loss and LVR. That is why fee tiers exist: a stablecoin pool can thrive on a few basis points because volume is enormous and divergence is tiny, while a volatile pair needs 30 basis points or more to compensate LPs for the risk they carry. Setting the fee too low starves providers; setting it too high pushes traders to a cheaper venue. Dynamic fees, now practical through V4 hooks, try to adjust this in real time so the pool charges more exactly when volatility makes LVR worse.

Early DeFi papered over thin fee income with token emissions, paying LPs in governance tokens to bootstrap liquidity. That mercenary capital tended to leave the moment the rewards dried up. The industry has since drawn a sharp line between those emissions and fees paid by real traders, which are the clearest form of real yield, as the debate over Solana’s revenue has shown. A pool whose returns come from actual volume is durable; one propped up by inflationary rewards is renting its liquidity.

This is also where AMM design meets protocol politics. Whether a protocol switches on a cut of fees for its token holders, how it splits fees between LPs and the treasury, and how it weighs real yield against growth are all governance fights that shape where liquidity chooses to live. The formula sets the ceiling on what a pool can earn; incentives decide how that earning is divided.

MEV, arbitrage, and the oracle problem

Arbitrage is both the hero and the villain of AMM design. It is what keeps a pool’s price honest: when an external market moves, arbitrageurs trade against the pool until its price matches, which is the only reason an AMM tracks the wider market at all. But that same flow is the channel through which LVR drains value from LPs, and it is a slice of the broader category of maximal extractable value, or MEV, that validators and searchers pull out of transaction ordering. The most predatory form is the sandwich attack, where a bot spots a pending swap, buys ahead of it to push the price up, and sells right after, leaving the victim with worse execution.

Designers have several levers against toxic order flow. Dynamic fees raise the cost of picking off a stale price. Batch auctions, used by intent-based systems, settle many trades at one clearing price so there is no ordering to exploit, and request-for-quote and solver networks route orders to professional market makers who compete to fill them. Newer research proposes auction-managed AMMs that sell the right to arbitrage the pool and return the proceeds to LPs, turning LVR from a leak into revenue. None of these is a complete fix, and each adds complexity that has to be audited.

The pool’s price is also a tempting data feed, which creates a separate hazard. Because an AMM’s spot price is just its current balances, a trader with enough capital (or a flash loan) can shove the price in one block and trick any contract that reads it. Uniswap V2 answered this with time-weighted average price oracles that are costly to manipulate over many blocks, and lending protocols generally prefer external oracle networks for exactly this reason. Even so, manipulation of thin AMM pools remains a recurring exploit vector, and smart-contract risk never fully goes away; even large, audited platforms fail in unexpected ways, as a 6.3 billion dollar signature exploit at a major exchange made clear this year.

The defensive playbook has matured in response. Protocols now lean on oracle feeds that aggregate many venues, cap how far a price can move in a single block, and read live prices from deep pools rather than thin ones that are cheap to push around. Front ends warn users about high price impact and route orders through aggregators that split a trade across several pools to blunt slippage. None of this makes an AMM tamper proof, but it narrows the gap between the price a pool shows and the price the wider market would agree on, which is the whole game.

Regulation, DeFi, and the SEC

AMM design does not happen in a legal vacuum, and the key question in the United States has been whether a liquidity pool and the interface in front of it amount to a securities exchange. The Securities and Exchange Commission pushed hardest on this in 2022, when it proposed amendments to Exchange Act Rule 3b-16 that would broaden the definition of an exchange, and in a 2023 reopening of the comment period it made explicit that it viewed some DeFi systems as falling inside that definition. Critics argued the proposal tried to fit permissionless code into a framework written for staffed trading venues.

The confrontation came to a head with Uniswap. In April 2024 the SEC issued a Wells notice to Uniswap Labs, signaling potential charges for operating as an unregistered exchange and broker and for the UNI token. Then the posture shifted. In February 2025 the SEC closed the investigation with no enforcement action, part of a broader pullback from crypto cases. Uniswap Labs framed the outcome in its Fighting for DeFi post as a milestone for the industry, while noting the multi-year process had cost it years of effort and millions of dollars.

The closure removed an immediate threat but not the underlying uncertainty. The core legal questions, whether an AMM pool is an exchange, whether a front-end operator is a broker, and when a governance token is a security, have not been settled by statute or court. Builders now design with compliance in mind even when no rule forces them to, adding geofencing, front-end controls, and the kind of transparency that onchain analytics firms increasingly expect. The formula may be neutral, but the interface and the entity behind it are not.

Where AMM design goes next

The frontier is no longer a better static curve; it is pools that adapt. Dynamic fees that track volatility, hooks that internalize arbitrage, and auction mechanisms that sell the first-trade right back to LPs all aim at the same target, shrinking LVR so passive liquidity can earn an honest return. Expect the next few years of competition to be fought over who loses the least to informed traders, not who quotes the lowest headline fee.

A second shift is the move from swaps to intents. Instead of sending a trade to a specific pool, a user states a desired outcome and a network of solvers competes to fill it, routing across many venues and often matching users directly before touching an AMM at all. In that world the AMM becomes liquidity of last resort, a deep and reliable backstop that solvers tap when they cannot do better elsewhere. Pool design still matters, but it shares the stage with the routing layer on top of it.

Finally, the asset mix is widening. Pegged-asset curves are being pointed at tokenized treasuries and other real-world assets, weighted pools at on-chain index products, and hook-driven pools at markets that did not exist when x times y equals k was first sketched out. The constant product formula will likely still be running somewhere, quietly quoting a price for a pair nobody else will touch, because its one unbeatable property is that it never stops. That durability, more than any single clever curve, is the real legacy of AMM design.

Frequently Asked Questions

What is an automated market maker in crypto?

An automated market maker is a smart contract that prices trades with a formula instead of an order book. Liquidity providers deposit pairs of tokens into a pool, and the pool quotes a price based on its balances. Traders swap against the pool and pay a fee, which goes to the liquidity providers.

What is impermanent loss and how do I avoid it?

Impermanent loss is the gap between holding two tokens and depositing them into an AMM pool when their relative price moves. It grows as prices diverge and shrinks if they return to where they started. You cannot fully avoid it in a standard pool, but pegged-asset pools, weighted pools, and swap fees can reduce or offset it.

What is the difference between Uniswap V2, V3, and V4?

Uniswap V2 spreads liquidity evenly across all prices and added on-chain price oracles. V3 introduced concentrated liquidity, letting providers focus capital in a chosen price range for much higher efficiency. V4, live since January 2025, keeps concentrated liquidity but adds hooks, which are custom plug-in logic, and a single-contract design that cuts gas costs.

Is the constant product formula the best AMM design?

There is no single best formula. Constant product, written x times y equals k, is simple and always provides liquidity, which suits volatile pairs. StableSwap is better for assets that trade near a fixed ratio, weighted pools suit custom portfolios, and concentrated liquidity wins on capital efficiency for active providers.

Are decentralized exchanges and AMMs legal in the United States?

Trading on AMMs is widely used in the United States, though the regulatory status of DeFi has been contested. The SEC once proposed treating some DeFi systems as exchanges and sent Uniswap Labs a Wells notice, but it closed that investigation without action in early 2025. Rules continue to evolve, so the legal picture can change.

Written by the HOGE Wire markets desk, covering DeFi protocol design, liquidity, and on-chain markets.

Share 𝕏 Post Telegram