DEX & AMM

Concepts: What Is DEX, AMM Model, Uniswap, Liquidity Pools, Impermanent Loss, Aggregators, CEX vs DEX, DEX Comparison

:::section{mins=10} What is a DEX :::

:::lead A DEX (decentralized exchange) swaps tokens straight from your wallet through a smart contract. In July 2026, spot trading volume on DEXs reached 24.1% of the volume on major centralized exchanges, the highest ratio on record. :::

:::p{html} When you buy ETH on Binance, you first hand the exchange your money, and from then on the app shows you a number the exchange promises to pay back. We covered this in 5.4 §1. A DEX skips that step. You connect your wallet, sign a transaction, and within a single block a smart contract takes one token from you and gives you another. Sometimes you need one more signature first, an approval that lets the contract spend your token (3.3 §5), but the approval itself doesn't move any tokens: it gives that contract the right to pull them up to the approved amount. You never hand your funds to an exchange in advance, since debiting one token and receiving the other happen in a single transaction. :::

:::p{html} That's why swapping through an open contract needs no sign-up and no KYC: the contract executes a transaction from any address. A particular website or service can still add its own restrictions, by country for example. Nobody approves listings, and anyone can create a pair for a new token in a few minutes. This is both the strength of a DEX and its biggest danger (4.3). There's no account in the usual sense, so there's nothing for an exchange to freeze, although an individual token's contract can block addresses on its own, as USDC and USDT can. The contract only swaps one crypto asset for another, though. To buy crypto with euros or rubles you need a separate service, an exchange or a fiat on-ramp, and some DEX interfaces build one right into their site. :::

:::p So how does a DEX decide what price to trade at? Three main approaches are in use today, and in practice they're often combined: :::

:::p{html}

  • AMM (automated market maker). You don't trade with another person but with a pool of two tokens, and a formula sets the price. Uniswap, PancakeSwap, Curve and most spot DEXs work this way. Quotes from professional market makers (RFQ, request for quote) also operate alongside the pools.
  • Order book. The same order mechanics as in 5.4 §3, just moved on-chain. This has become the dominant approach for perpetual futures, and it powers Hyperliquid, the leading perp DEX, along with most of its rivals. Pool-based models priced by an oracle, such as GMX and Jupiter Perps, are still very much alive too. On these exchanges you usually deposit funds into the exchange contract first and trade from that balance.
  • Intents. Instead of a finished trade, you sign a wish along the lines of "I'll give 3,000 USDC and want at least 0.99 ETH back," and fillers compete for the right to fulfill it. This isn't a separate pricing formula but a way of executing a trade, and the filler can source liquidity from a pool, an order book or its own balance. CoW Swap and UniswapX work like this, and there's more in §6.
:::

:::p How big is all of this? According to The Block and DefiLlama, spot volume on DEXs in July 2026 came to 24.1% of the volume on the major CEXs they track. For almost all of 2024 that figure stayed below 10%. Keep in mind that it's a ratio, not a market share. The record came in a month when volumes on centralized exchanges fell harder than on DEXs. :::

:::callout Picture a self-service car wash on the edge of town. There's no attendant, just a coin machine and a bay. Your coins stay in your pocket until you drop them into the slot yourself, and nobody can take them or "freeze" them. The machine doesn't ask for ID, and at three in the morning it works exactly as it does at noon. But if you hit the wrong button and get wax instead of foam, there's no one to complain to, because the money is already inside. And anyone can set up their own machine right next to the real one, with the same sticker on it, and it will happily take your coins too. A DEX works the same way. The contract faithfully carries out whichever button you press, and you're the only one who can check that you walked up to the right machine. :::

:::keypoints{label="Key Points"}

  • The key difference with a DEX is who you trust. Instead of a company holding your money, you rely on the contract's code and on your own care when you sign.
  • Since anyone can issue a token, a name and a logo prove nothing. Only the contract address tells you a token is genuine, and you have to check it every time you buy one you don't know.
  • The pricing models don't compete so much as complement each other. A single swap can go through a pool, a market maker's quote or a solver, and users often can't even see which route was taken.
  • No KYC at the contract level doesn't make a DEX anonymous. Every trade from an address stays on a public blockchain forever, and if that address has ever been linked to an exchange, your whole history is visible. :::

:::details{badge=Advanced title="What happens during a swap and where the risks hide"} :::p{html} A swap from the inside :::

Pressing the "Swap" button sets off a chain of several steps, and it helps to know where each of them can go wrong. First, the interface builds a transaction to the router contract and fills in its parameters: how many tokens you're giving, the minimum amount you're willing to accept, and a deadline after which the transaction is no longer valid. Your wallet shows it to you, you sign, and the transaction goes out to the network.

Everything after that happens inside a single block. The router pulls your tokens using the approval you gave it earlier, passes them to the pool, the pool sends back the other token, and at the very end the router checks that you received at least the minimum amount. If the price moved while you were waiting and the amount falls short, the whole transaction reverts as if it never happened. You keep your tokens, but you still pay gas for the attempt. This atomicity is the core protection a DEX offers, since a trade either goes through entirely on your terms or doesn't go through at all.

:::p{html} The interface derives the minimum amount from your slippage tolerance. If the quote promises 1 ETH and your tolerance is set to 0.5%, the transaction will accept no less than 0.995 ETH, and anything between those two numbers can be taken by whoever manages to move the price just ahead of your trade. The deadline guards against a different scenario, where a transaction with a low fee sits in the queue for hours and finally executes in a completely different market. A wide tolerance and a distant deadline are convenient because the transaction almost never reverts, but they're exactly what turns your swap into prey for the bots we'll look at in 5.6. :::

:::p{html} Risk in the token itself :::

:::p{html} Not every token behaves like a standard ERC-20. Some take a hidden fee on every transfer, sometimes tens of percent, so the pool receives less than you sent. Ordinary swap functions break on tokens like these, which is why the Uniswap V2 router even has separate functions labeled as supporting fee-on-transfer tokens. Other tokens only let selected addresses sell. You can buy one, but you can't sell it back, and in crypto slang that's called a honeypot. We covered how to spot such tokens in 4.1 §3. :::

:::p{html} Still others let the contract owner block wallets, mint new tokens, or even swap out the code entirely through an upgradeable proxy. Perfectly legitimate assets can have blocking too, USDC and USDT among them, whose issuers freeze addresses at the request of authorities. Before buying a new token, it's worth opening its contract in a block explorer to see whether the source code is published, who the owner is, and what the owner can change. Token-checking services do this automatically and simulate a buy and a sell. We went through the other red flags of new tokens in detail in 4.3 §4. :::

:::p{html} Contract and interface risk :::

:::p{html} You're trusting code, not an exchange. If the pool contract or a module plugged into it has a bug, the money can end up with an attacker, and there's nobody to get it back from. That's why large DEXs go through audits for years and run bug bounty programs (4.2 §5). Small forks usually have none of this. :::

A DEX's website and the DEX itself are two different things. The protocol lives on the blockchain, and the site is just one of the doors leading to it, a door someone can swap out. In August 2022, attackers hijacked the DNS record for curve.fi, and users who signed transactions on the fake copy of the site lost more than half a million dollars. In September 2023, a similar attack through a domain registrar hit the Balancer site and cost users about $238,000. In both cases the contracts were untouched, and the address in the browser bar looked right. So the most useful thing to check isn't the site's address but what your wallet actually shows you before you sign.

:::p{html} Approval and signature risk :::

For the router to pull your tokens, you first give it an approval. To make things convenient, interfaces often ask for an unlimited approval, and it stays in place after the trade. If the contract turns out to be malicious or gets hacked, it can drain those tokens later without any action from you. Uniswap proposed the Permit2 standard, where you grant an unlimited approval once to a shared contract and then give each app its own separate signature with a limited lifetime.

:::p{html} Signatures have a trap of their own. A permit signature costs no gas and looks like harmless text, which is exactly why phishing sites love to ask for one. Once attackers have that signature, they send the transaction themselves and take the tokens. The rule that follows is simple: read any signature that mentions an approval, an amount and a recipient address as carefully as you'd read a regular transaction. We covered how to check and revoke approvals in 3.3 §5. ::: :::

:::further{label="Further Reading"}

:::quiz{id=q-5-5-s1 label="Check yourself" correct=2 explanation="The Block divides monthly DEX volume by the volume of a selected group of major CEXs. That's a ratio, not a share of the whole market. In July 2026, DEX volume in dollars actually dropped, but CEX volume fell even further, so the ratio hit a new record."} What does the July 2026 record of "24% of CEX volume" actually mean?

  • Nearly a quarter of all spot crypto trading worldwide went through DEXs
  • In July, DEXs set an all-time record for trading volume in dollars
  • DEX volume hit 24% of major CEX volume, largely because CEXs fell
  • Nearly a quarter of users moved from centralized exchanges to DEXs :::

:::section{mins=11} AMMs: how a pool sets its own price :::

:::lead An AMM replaces the seller on the other side with a pool of two tokens and a formula. In the classic version the product of the reserves, x × y, can't go down, so every purchase costs more than the one before it. :::

:::p{html} Who sells you ETH when you hit "Swap" at three in the morning? In the order book from 5.4 §3, you need a real person or a market maker on the other side. An AMM does without them. The contract holds a pool, say 100 ETH and 300,000 USDC, and anyone can take one token out by putting the other one in. The only question is how much to put in. :::

:::p The formula x × y = k answers it. Here x is the amount of ETH in the pool, y is the amount of USDC, and k is their product, which mustn't shrink after a swap. In our pool, k is 30 million. Want to take out 1 ETH? That leaves 99 ETH in the pool, and to keep the product the same, the USDC side has to grow to 30,000,000 / 99, or roughly 303,030. So you pay 3,030 USDC. We're leaving the fee out of these examples for now. Without it the product stays constant, while with it part of the payment stays in the pool and k creeps up a little with every trade. :::

:::p{html} Look closely at the numbers and you'll see that before the trade the pool price was exactly $3,000, your average purchase price came out at $3,030, and afterward the pool values ETH at about $3,061. This is the price impact we talked about in 5.4 §6. Try buying 10 ETH at once and your average price jumps to $3,333. The smaller the pool is relative to your trade, the harder the formula pushes back. On top of that comes the pool fee, usually between 0.01% and 1%, which goes to the liquidity providers. :::

:::p{html} How does the pool know the real price of ETH? It doesn't, because the formula only sees its own reserves. If ETH trades at $3,100 on a CEX and $3,061 in the pool, an arbitrageur will buy in the pool and sell on the exchange, and keep doing it until the prices meet. We covered how arbitrage works in 5.4 §7. So a classic AMM has no idea what the outside price is, and arbitrage is what links it to other venues. When the price moves there first, the pool follows with a delay, and liquidity providers are the ones who pay for that lag. We'll come back to this in §5. :::

:::p The formula x × y = k is only the first of many. Curve uses a curve for stablecoins that's almost flat around one dollar, and Uniswap V3 lets liquidity be concentrated in a narrow price range. We'll work through the math behind these models in card 6.2. :::

:::callout At a summer camp, a counselor runs a trading post with a jar of candy and a box of stickers. There are no price tags, only one rule: the number of candies multiplied by the number of stickers can't get smaller after any trade. In the morning the jar holds 100 candies and the box holds 100 stickers, so you can easily swap one sticker for about one candy. By lunchtime the whole cabin is hunting for stickers, there are only 50 left and 200 candies in the jar, and the next sticker now costs you about four candies. The counselor didn't decide anything or study the market; the contents of the two containers pushed the price up on their own. Then one of the older kids notices that stickers are cheaper at the camp next door, brings back a whole stack, walks off with candy, and prices at the two camps even out. :::

:::keypoints{label="Key Points"}

  • Nobody sets the price in an AMM. It comes from the ratio of the reserves, and since every swap changes that ratio, the pool price moves after any trade, even the smallest one.
  • The formula's resistance grows faster than the size of the trade. The bigger the share of the reserve you take, the more each additional unit costs, and buying out the entire pool is impossible by design.
  • Pool depth often matters more than the fee rate. A swap with a 0.05% fee in a shallow pool can cost more than one with a 0.3% fee in a deep pool, because price impact is the main expense.
  • Check the price impact before you swap. If it's more than a couple of percent, compare quotes through an aggregator that can split the trade across several pools. Breaking it into several trades in the same pool won't remove the impact on its own, since each one starts from the price the previous one moved. :::

:::details{badge=Advanced title="Pool math and other formulas"} :::p{html} How much you get, calculated exactly :::

The formula x × y = k gives a simple rule for any swap. If you put Δx of one token into the pool, you get y × Δx / (x + Δx) of the other. The fee is taken off on the way in, so at a 0.3% rate only 99.7% of what you deposit goes into the calculation. Let's sell 10 ETH at once into our pool of 100 ETH and 300,000 USDC. The formula sees 9.97 ETH, and the pool pays out 300,000 × 9.97 / 109.97, or about 27,198 USDC. Your average sale price works out to around $2,720 instead of $3,000, and the new pool price drops to almost $2,480.

This leads to a handy rule of thumb that holds for an x × y = k pool of any size. If you take a fraction a of one token's reserve, your average purchase price rises by a factor of 1 / (1 − a), and the pool price after the trade by a factor of 1 / (1 − a)². Take 1% of the reserve, and your average price goes up by about 1% while the pool price rises 2%. Take 10%, and that's already 11% on your average price and 23% on the pool price, while a quarter of the reserve will cost you a third more than the current price. So by looking at pool depth in the interface, you can estimate in advance what a trade will cost.

The fee also changes the invariant itself. Without a fee the product after a trade stays exactly the same, but with one the pool keeps slightly more tokens than the formula requires. If you buy 1,000 USDC worth of ETH from our pool at a 0.3% rate, k grows from 30,000,000 to about 30,000,300. Each trade inflates the pool a little, and that growth is what liquidity providers collect as their fees when they withdraw.

:::p{html} StableSwap and the amplification coefficient :::

For tokens that are supposed to be worth the same, x × y = k is wasteful, because liquidity is spread across every price from zero to infinity while trading happens around one dollar. At the opposite extreme there's x + y = k, where the price is always exactly one to one and there's no price impact at all. But a pool like that gets drained the moment one of the tokens loses its peg, since everyone dumps the cheaper token into it and takes out the sound one at the old rate.

In 2020, Curve combined the two formulas. The StableSwap invariant behaves like a sum while the reserves are roughly equal and smoothly turns into a product when they become heavily lopsided. How long the pool stays in sum mode is set by the amplification coefficient A. For stablecoin pools it typically runs into the hundreds or thousands, so with balanced reserves even swaps worth millions barely move the price. But if one token seriously depegs, the pool gradually fills up with it, and its price starts falling along the product curve. That's what happened in March 2023, when USDC briefly dropped below $0.90 after the trouble at SVB, and within a few hours Curve's stablecoin pools were stuffed with USDC.

:::p{html} Weighted pools and concentrated liquidity :::

Balancer generalized the formula to a product of several reserves, each raised to the power of its weight. An 80/20 pool aims to keep 80% of its value in one token and 20% in the other, working like an index portfolio that rebalances itself. Impermanent loss on the main token is noticeably smaller than in a 50/50 pool. That's why projects that need liquidity for their own token, without having to put up half the value in stablecoins, often choose pools like these.

Uniswap V3 tackled the same problem of spread-out liquidity differently. A position in a range behaves like a slice of an ordinary x × y = k pool, only with virtual reserves much larger than what was actually deposited. The efficiency gain for a range around the current price is roughly 1 / (1 − (pa / pb)^¼), where pa and pb are the lower and upper bounds. For ETH in a range from $2,500 to $3,500 that's about 12 times, and for a range from $2,970 to $3,030 it's already about 200 times. By the V3 authors' estimate, capital in a very narrow range for stable pairs can be up to 4,000 times more efficient than in V2. The downside is the same as in §4: the narrower the range, the more often the price leaves it.

:::p{html} Proprietary AMMs :::

In 2025 a new category grew up on Solana: proprietary AMMs (prop AMMs) with no website of their own. A market maker's algorithm updates their prices, and traders reach them through aggregators. Within a year these pools became a noticeable part of the market. According to DWF Ventures as of September 2026, they account for 15% to 27% of daily volume across all DEXs worldwide, and about 90% of that activity happens on Solana. Analysts put their share within Solana itself anywhere from a third to 70% of the network's volume, depending on which pools they count as proprietary. In effect, this is the professional market maker coming back, just dressed up as a pool.

These pools are built differently from classic ones. They have no formula known in advance; instead, the market maker updates the price with separate cheap transactions several times a second, tracking prices on centralized exchanges. Thanks to this the pool barely lags the market, and arbitrageurs find it harder to profit from than an ordinary AMM. In return, traders have to trust an algorithm whose code is usually closed, and the liquidity in the pool belongs to a single team that can pull it at any moment. :::

:::further{label="Further Reading"}

:::quiz{id=q-5-5-s2 label="Check yourself" correct=0 explanation="After your purchase the pool holds 45 ETH. To keep the product at 7.5 million, the USDC side has to become 7,500,000 / 45, or about 166,667. It started at 150,000, so you pay about 16,667 USDC. Buying 10% of the pool's reserve pushed your average price up by 11%."} A pool holds 50 ETH and 150,000 USDC (k = 7.5 million). You buy 5 ETH. How much USDC do you have to pay, not counting the fee?

  • About 16,667 USDC, averaging about $3,333 per ETH
  • Exactly 15,000 USDC, at the current pool price of $3,000
  • About 15,150 USDC, only 1% above the current price
  • About 18,750 USDC, because the price grows as a square :::

:::section{mins=9} Uniswap: the protocol that set the standard :::

:::lead Uniswap is still the largest spot DEX by trading volume. According to DefiLlama, in the 30 days to mid-September 2026 it handled about $71 billion, more than the next three DEXs combined, and it runs on more than 40 networks. :::

:::p Hayden Adams launched the first version of Uniswap in November 2018, and since then nearly every new version has changed how the DEX market works: :::

:::p{html}

  • V2 (May 2020). A pool between any two ERC-20 tokens, using the x × y = k formula from §2. It's still running today.
  • V3 (May 2021). Added concentrated liquidity, so a provider picks their own price range and their capital works much harder (§4).
  • V4 (January 31, 2025). All pools live in a single contract, and you can attach a hook to a pool, meaning your own code that runs on a swap or a liquidity change.
:::

:::p Over the same 30 days to mid-September 2026, V4 overtook V3 in volume, with roughly $38 billion against $32 billion. :::

:::p It's worth keeping the protocol and the website apart. The Uniswap protocol is a set of contracts on the blockchain, and you can use it through any interface, wallet or aggregator. The app.uniswap.org site is just one of those entry points, built by the company Uniswap Labs. For years Labs charged a separate interface fee on swaps made through its site. That changed in December 2025, when the DAO approved the UNIfication proposal. Labs dropped its interface fee to zero, a protocol fee was switched on for some pools with the proceeds going to burn UNI, and 100 million UNI were burned from the treasury in a one-off move. :::

:::p{html} So what does a swap actually look like? You pick a pair and an amount, and the interface works out the route for you, sometimes through several pools at once. Before you sign, check three numbers: the minimum amount you'll receive, the price impact and the slippage tolerance. Slippage tolerance tells you how much worse than the quoted price the final price can be before the transaction cancels itself. Setting it too wide invites bots, and we cover that in detail in 5.6. Wallets like Rabby show a simulation of exactly what will leave your wallet and what will arrive. :::

:::p{html} And how much does the swap itself cost? The old line that everything on Ethereum is expensive no longer holds. According to ethereum.org, in May 2026 a swap on mainnet with gas at about 0.15 gwei cost roughly 20 cents, and on an L2 it's a fraction of a cent. That's a snapshot of one period, though. Gas prices depend on how busy the network is, and a route through several pools burns more gas than a simple swap. We looked at how gas prices are formed in 3.3 §4. :::

:::callout A guitarist shows up to a gig with their own guitar and amp. At first everyone sounds more or less the same, until a pedalboard goes in between the guitar and the amplifier. One pedal adds overdrive, another adds echo, a third only kicks in on the chorus. Each pedal slots into the chain at its own point and changes whatever passes through it, without touching the guitar or the amp. Uniswap V4 works in a similar way. Every pool shares the same base, and a hook acts like a pedal the pool's creator has plugged into the chain. One raises the fee when the market gets stormy, another turns the pool into a limit order. But if someone soldered a pedal together at the kitchen table, it can short out the whole rig, and the pedal is what you'll have to blame, not the amp. :::

:::keypoints{label="Key Points"}

  • Separating the protocol from the website protects against any single company shutting down, but it hands the choice of entry point to the user. In practice, a fake interface pointing at the real contracts is more dangerous than a failure of the protocol itself.
  • UNIfication tied the UNI token to the protocol's trading activity. The more people trade through pools with a protocol fee, the more UNI gets burned, and the token stops being just a voting tool.
  • Cheap gas changed the economics of small swaps. When a transaction costs cents, the choice between mainnet and an L2 increasingly depends on where the liquidity you need sits, not on the price of gas.
  • The most expensive swap mistakes rarely have anything to do with fees. People lose far more to a slippage tolerance set too wide and to signing a transaction on a fake site than to gas or the pool's fee rate. :::

:::details{badge=Advanced title="How V4 works and where hooks break"} :::p{html} One contract for every pool :::

In V2 and V3 every pool was its own contract, and creating a pool meant deploying new code. In V4 all pools live inside a single PoolManager contract, and a pool is just an entry in its storage. Creating a pool got much cheaper, and a route through several pools no longer has to move tokens from contract to contract at every step.

A trick called flash accounting makes this possible. While the transaction runs, PoolManager only records who owes whom how much, and the real transfers happen once at the very end, when all the debts are netted into a final balance. If anything doesn't add up at the end, the transaction reverts. Keeping these intermediate records is cheap thanks to transient storage, which arrived on Ethereum with the Dencun upgrade in March 2024. V4 also brings back support for native ETH, so you no longer need to wrap it into WETH to swap.

:::p{html} What hooks can do :::

A hook is a separate smart contract that the pool calls at predefined moments: before and after a swap, before and after liquidity is added or removed, and when the pool is created. Which moments a hook intercepts is encoded right in the last bits of its address, so the set of functions can't be swapped out after the pool is created. The functions themselves, though, can do almost anything.

Builders use hooks for dynamic fees that rise in volatile markets and cut providers' losses, for limit orders, for purchases spread out over time (TWAP), for pools open only to verified participants, and for auctions that sell the right to the first trade in a block and pass the proceeds back to providers. A hook can even replace the pool's formula entirely, at which point V4 simply works as shared infrastructure that anyone can build their own AMM on. Uniswap has gone from a finished product to a platform for other people's products.

A dynamic fee is a good way to see how this plays out in practice. Before every swap, the hook checks how much the price has moved over the last few blocks and sets the rate. In a calm market it might be 0.05% to attract ordinary traders, and in a sharp move it can climb to 0.3% or higher. The arbitrageur who shows up to realign the price after a jump pays more for the trade, and some of the money that used to go to them stays with providers. An ordinary trader loses almost nothing in quiet hours and pays more during sharp moves, but in return gets a deeper pool that providers haven't fled.

:::p{html} How Cork broke :::

The flip side is that hook code isn't written by Uniswap Labs, and the audit of the core protocol doesn't cover it. In May 2025 an attacker drained about $12 million in wstETH from Cork Protocol. The main bug turned out to be the beforeSwap function in Cork's hook. It was supposed to be callable only from PoolManager, but it had no check on who was calling it. The attacker created their own Cork market on a fake token, called the function directly with crafted data, and the protocol credited them with a deposit that never happened.

The second bug was in Cork itself. Just before a market rolled over into a new period, the attacker used a small purchase to skew the calculated price ratio, then swapped a tiny amount for thousands of tokens and redeemed them for wstETH. Uniswap's contracts weren't hacked, but that's cold comfort for anyone who had money in that pool. Upgradeable hooks carry a risk of their own, because if the author can replace the code, a harmless module can turn malicious after liquidity has already come into the pool.

:::p{html} How to check a pool with a hook :::

For an ordinary swap, the interface or aggregator almost always builds the route automatically. That's convenient, but it doesn't guarantee that every contract along the route has been vetted, so it makes sense to send large amounts through well-known interfaces and look at which pools the trade passes through. Before adding liquidity to a V4 pool with an unfamiliar hook, open the hook's address in a block explorer and check whether the code is published, whether it's been audited, whether it has an owner and whether that owner can change the code or parameters. If even one of these questions has no clear answer, that pool is best left to people prepared to assess the risk professionally. :::

:::further{label="Further Reading"}

:::quiz{id=q-5-5-s3 label="Check yourself" correct=3 explanation="Uniswap pools live on the blockchain as standalone contracts. The website only assembles a transaction and sends it to the network. Dozens of wallets, aggregators and alternative interfaces call those same contracts, so shutting down one website has no effect on how the pools work."} Suppose Uniswap Labs shuts down app.uniswap.org tomorrow. What happens to the pools?

  • The pools stop working, because the website controls all the contracts
  • Liquidity providers' funds are frozen until the DAO makes a decision
  • The DAO has to redeploy the contracts and launch a new website
  • The pools keep working and stay reachable through other interfaces :::

:::section{mins=9} Liquidity providers :::

:::lead Pools are filled by ordinary users called liquidity providers (LPs). They deposit two tokens and earn a share of the fees. In a simple V2 pool with a 0.3% fee, $10 million in daily volume brings all providers together $30,000 a day. :::

:::p If you're holding ETH and USDC, it's natural to wonder whether you could become that "exchange" yourself. You can, because somebody filled the pool from §2, and that somebody earns a fee on every swap. :::

:::p In a classic V2 pool you deposit both tokens in equal value, say 1 ETH and 3,000 USDC, and receive an LP token that represents your share of the pool. Fees build up right inside the pool, and when you exit you take your share along with them. The fee rate is matched to the pair: :::

:::p{html}

  • 0.01% for pairs whose prices barely drift apart, such as USDC and USDT.
  • 0.05% for large, liquid pairs like ETH and USDC.
  • 0.3% as the standard for most pairs.
  • 1% for exotic and highly volatile tokens, where the provider takes on more risk.
:::

:::p In V4 the fee can be set to any value, and with a hook it can even change on the fly. :::

:::p V3 introduced concentrated liquidity. You choose your own range, for example ETH between $2,500 and $3,500, and your capital only works inside it. Concentration gives each dollar you put in a bigger share of the active liquidity, but what it actually earns depends on the volume in your range, the fee tier and how much liquidity others have placed nearby. But a narrow range doesn't guarantee income, because the price can leave it quickly. The moment it crosses a boundary, the whole position turns into just one of the two tokens. Above the upper bound you're left holding only USDC, because the pool sold all your ETH on the way up, and below the lower bound you hold only ETH. In that state the position earns nothing until the price comes back or you move it. Every position has its own boundaries, which is why V3 represents it as an NFT rather than a regular token. :::

:::p How much can you actually make? The easiest place to work it out is a V2 pool. An ETH/USDC pool with a 0.3% fee and $10 million in daily volume collects $30,000 in fees a day. If your share is 0.1% and all the fees go to providers, you're owed $30 a day. You can't calculate it that way in V3 and V4. A trade's fee is split only among the positions whose range the price fell into, so your income depends on how much liquidity sits near yours and where the trades took place. On top of that, since UNIfication a small slice of the fee on some Uniswap pools goes to the protocol. And from any income you still have to subtract gas for entering, exiting and moving your range, plus, most importantly, impermanent loss, which is the subject of §5. :::

:::callout You and your neighbors run a rental shop on a ski slope. Everyone puts an equal amount of skis and snowboards into the shared storeroom, and the till takes a small fee on every swap, which gets split according to each person's share. Swaps at the till are automatic. Whoever hands in skis gets a snowboard and vice versa, and the price shifts in favor of whatever the storeroom is short on. In a normal season the stock swings back and forth while the kitty slowly grows. If you want to earn more, you can put your gear out only during peak hours, from nine to twelve, when the line is longest. Each of your hours brings in more, but if the crowd of skiers shifts to the evening, your gear will just sit there. That's how choosing a price range works in V3. :::

:::keypoints{label="Key Points"}

  • A liquidity provider ends up as a market maker whether they planned to or not. The pool sells their tokens as they rise in price and buys more as they fall, and the fees are the payment for that work.
  • The fee rate reflects the risk of the pair. A high fee on a volatile token isn't a gift to the provider but compensation for the chance that the price moves hard and stays in one direction for a long time.
  • Concentrated liquidity turns a passive investment into active management. If you don't keep an eye on your range, you risk spending most of the time holding a position that earns nothing.
  • The yield a pool's interface shows is usually calculated from past fees. It doesn't promise future volume and doesn't account for impermanent loss, so it's worth comparing against what you'd have made by simply holding. :::

:::details{badge=Advanced title="Other ways to be a liquidity provider"} :::p{html} Liquidity for a single trade :::

Concentrated liquidity opened the door to a technique called JIT (just-in-time) liquidity. A bot spots a large swap waiting in the queue and sends the block builder a bundle of three transactions along with it. The first adds a huge position in a very narrow range around the current price, the second is the swap itself, and the third pulls the position back out.

Take a hypothetical example in which a $5 million swap hits a pool with a 0.05% fee, paying $2,500 in fees. Regular providers have $20 million of liquidity near the current price, and for one block the bot adds another $100 million. Fees are split in proportion to liquidity in the active range, so the bot takes about $2,083, and regular providers are left with about $417 instead of $2,500. The bot takes on almost no impermanent loss, since it holds the position for a single trade. It pays in gas and a cut to the block builder, which is why JIT only pays off on large swaps.

:::p{html} Managed vaults :::

Moving your range by hand is slow and costly, so services like Arrakis and Gamma appeared to do it automatically. You deposit tokens into their vault, and an algorithm moves the range for you in exchange for a percentage of the income. That saves time, but it adds one more smart contract you have to trust and one more fee between you and the pool's income. It's also worth knowing that every repositioning locks in impermanent loss, because by the time you leave the old range the position is already skewed toward the token that got cheaper. Frequent rebalancing in a trending market can turn out worse than one wide range that simply stays put.

:::p{html} Liquidity without a deposit :::

In 2025 and 2026, models appeared in which the provider doesn't move tokens into a pool at all. The most visible of them is 1inch Aqua, which launched publicly in July 2026 on 13 networks. You grant an approval on your tokens, and they stay in your wallet. From there you create positions similar to Uniswap's, whether full-range, concentrated or pegged for stablecoins, and choose the pair, range and fee yourself. When a matching swap comes in, the protocol pulls the needed tokens from your wallet in one transaction and returns the opposite token along with the fee.

The core idea behind Aqua is that one balance backs several positions at once. In 1inch's own example, $100,000 in a wallet can support three positions quoting $300,000 in total, with nothing borrowed. It keeps a provider's capital from sitting idle, but it brings two new catches. The spending approval stays open for as long as the positions are live, and that's exactly the risk we discussed in §1. Also, there are more quotes than real money, so once one position has used up your balance, the others simply stop filling. Superposition, from the Barter team, offers a similar idea for stablecoins, but for now the team itself makes the trading decisions there and decentralization is still only a promise.

:::p{html} Perp exchange vaults :::

Perpetual futures exchanges have their own version of liquidity provision, the liquidity vault. On Hyperliquid it's HLP, on Jupiter Perps it's the JLP pool, and on GMX it's the GM pools. You deposit money and, through the vault, become the counterparty to traders. In JLP, traders borrow the pool's tokens for leverage, and JLP holders get 75% of the fees from those markets. HLP places orders in the order book itself and takes over the positions of liquidated traders.

The risk here works differently from an AMM pool. Traders' losses become your income, and their winnings are paid out of the vault. As long as traders lose on the whole, the yield looks great, but one big lucky player can take a noticeable chunk of it. In March 2025 HLP lost about $4 million when a whale with huge leverage on ETH withdrew part of their collateral, pushed their own position into liquidation and left the vault to close it at a loss. That same month, an attack using the thinly traded JELLY token ended with Hyperliquid's validators hastily delisting the market and settling positions at a price that favored the vault. Depositors' money was saved that time, but it showed how heavily a decentralized exchange depends on the decisions of a small group. On top of that, JLP loses value along with the SOL, ETH and BTC held in the pool. :::

:::further{label="Further Reading"}

:::quiz{id=q-5-5-s4 label="Check yourself" correct=1 explanation="While ETH was rising, the pool was selling your ETH to buyers. At the upper end of the range all the ETH has been sold, and the position consists only of USDC. Above $3,500 your liquidity takes no part in trading. The protocol can't move the range on its own, so that's up to you or a management service."} Your Uniswap V3 position in the ETH/USDC pool is set to a range of $2,500 to $3,500. ETH has risen to $3,800. What's happened to your position?

  • It's entirely in ETH and earns twice as much in fees
  • It's entirely in USDC and earns nothing while out of range
  • The protocol automatically moved the range to follow the price
  • It was liquidated, and the provider lost part of the deposited tokens :::

:::section{mins=12} Impermanent loss :::

:::lead Impermanent loss measures how far a pool position falls behind simply holding the same tokens. In a classic x × y = k pool, a 2x move in one token's price against the other leaves you about 5.7% behind, before fees. :::

:::p Say you put 1 ETH and 2,500 USDC into a pool when ETH was trading at $2,500, so $5,000 in total. A month later ETH is at $4,000. If you'd just kept the tokens in your wallet, you'd have $6,500. So what's left in the pool? :::

:::p As ETH climbed, arbitrageurs kept buying it from the pool at a lagging price, just like in §2. Your share ends up holding about 0.79 ETH and 3,162 USDC, roughly $6,325 altogether. You made $1,325, but you trail plain holding by $175, or 2.7%. That gap is impermanent loss. By design, a pool sells the token that's rising and buys the one that's falling, and in a strong move that always does worse than sitting still. :::

:::p In a classic 50/50 pool, the size of the loss depends only on how much one token's price changed relative to the other, not on which way it moved. Narrow V3 ranges lose more; see the Advanced block. A 50% drop hurts exactly as much as a 2x rise: :::

:::p{html}

Price changeBehind holding
×1.25 or −20%0.6%
×1.5 or −33%2.0%
×2 or −50%5.7%
×3 or −67%13.4%
×5 or −80%25.5%
:::

:::p Why call the loss impermanent? If the price goes back to where it started, the gap disappears and you keep the fees you earned. The name is misleading, though. If you exit the pool after the price has moved, the loss is locked in for good, and nothing obliges the price to come back. :::

:::p How much does this matter in practice? A study by Topaze Blue and Bancor looked at 17 large Uniswap V3 pools from May 5 to September 20, 2021, which together held 43% of the protocol's liquidity. LPs earned $199.3 million in fees, while impermanent loss came to $260.1 million. Almost half of the 17,000 wallets studied, 49.5%, would have been better off just holding their tokens. The takeaway is that providing liquidity only beats holding when fees cover impermanent loss plus the gas and effort of managing the position. Pairs that trade close to each other, like USDC and USDT or ETH and stETH, barely suffer from impermanent loss, but they carry a different risk, a depeg of one of the tokens. If a stablecoin or stETH slips, the pool will automatically load you up with more of exactly that token. :::

:::p Keep in mind, too, that impermanent loss only compares the pool with holding the same tokens and says nothing about your result in dollars. If both tokens fall, you lose money with or without a pool. On top of that come the risk of a bug in the pool or hook contract and the risk of whatever service you trusted to manage your position (§4). So impermanent loss is just one line on a liquidity provider's list of risks, even if it's the easiest one to miss. :::

:::callout There's a kiosk on the boardwalk selling umbrellas and sunglasses, with a restocking machine attached. It keeps the value of umbrellas and sunglasses equal at all times, and whenever more of one sells, it immediately buys more of it using the other. In a week of changeable weather, that works fine. Then a heat wave hits, sunglasses get pricier every day, and the kiosk keeps selling them at yesterday's price while filling the stockroom with umbrellas nobody wants. By the end of the heat wave you have a mountain of umbrellas and a couple of pairs of sunglasses. Had you just left a box of sunglasses in the back room, it would now be worth twice as much. When the rains return and umbrellas go up in price, the gap will narrow. Sell the kiosk at the height of the heat, and that difference stays with you forever. :::

:::keypoints{label="Key Points"}

  • Impermanent loss shows up in any pool that holds two different assets. It isn't a bug in some particular protocol but a direct result of the pool keeping its tokens in a fixed ratio.
  • With small price swings the loss grows slowly, and with big moves it grows fast. While the price stays in a narrow band the loss is small, and fees can cover it if volume is high enough, but a long trend in one direction eats into returns faster than anything else.
  • Fees and loss come from different things. Income comes from trading volume, while loss comes from prices drifting apart, so the best setting for an LP is busy trading with no lasting trend.
  • Before you enter a pool, ask yourself whether you're willing to hold both tokens in any ratio. If there's one you wouldn't want to own at all, providing liquidity in that pair isn't for you. :::

:::details{badge=Advanced title="The math of the loss, ranges, and LVR"} :::p{html} Where the formula comes from :::

In an x × y = k pool, the price of ETH is y / x, so for any price P the pool's reserves are fully determined. The pool holds √(k / P) ETH and √(k × P) USDC, and the whole position is worth 2√(k × P). If you'd simply held the original tokens, their value would rise linearly with the price. Divide one by the other after the price changes by a factor of r and you get 2√r / (1 + r). At r = 2 that's 2 × 1.414 / 3, or 0.943, which is where the 5.7% comes from. The formula holds for a pool without fees that you entered with tokens of equal value.

The formula also shows why the loss grows nonlinearly. A 10% price change costs about 0.1%, a 2x move costs 5.7%, and a 5x move already costs 25.5%. When prices drift only a little apart, the impermanent loss is small, but fees cover it only if volume is high enough, and a long one-way trend eats into returns faster than anything else.

:::p{html} Why a narrow range amplifies the loss :::

With V3 concentrated liquidity, a position inside its range behaves like a slice of a pool whose virtual reserves are many times larger than the real ones. Fees get multiplied by the same factor, and so does impermanent loss. Take a position opened with ETH at $3,000 and check it after ETH rises 10% to $3,300. A full-range position trails holding by about 0.1%. A $2,500–3,500 range trails by about 1.4%. A narrow $2,800–3,200 range trails by about 3.1%, and on top of that the price has already left the range, so the whole position has turned into USDC.

So a narrow range is a bet that the price will keep moving inside it and that fees will make up for a loss that's been multiplied many times over. Once the price crosses the boundary, the position locks in the maximum loss for that range and stops earning. That's why professional LPs size their ranges to the pair's volatility, not to how much fee income they'd like to collect.

:::p{html} The loss that doesn't go away (LVR) :::

In 2022, researchers Milionis, Moallemi, Roughgarden, and Zhang proposed another way to measure an LP's costs, called LVR (loss-versus-rebalancing). Instead of comparing the pool with simple holding, it compares it with a portfolio that keeps the same token shares but rebalances at the market price. The gap appears because the pool always trades at a stale price and arbitrageurs pocket the difference. LVR isn't a charge anyone deducts from your account. It's an economic measure of what you lose by trading at a lagging price. Unlike impermanent loss, though, it doesn't vanish when the price comes back, and it piles up with every market move.

For an x × y = k pool, the authors derived a simple estimate. Over a year, LVR comes to roughly σ² / 8 of the pool's value, where σ is annual volatility. For a pair with 60% volatility, which is typical for ETH, that's 0.36 / 8, or about 4.5% of the pool's value per year. In other words, just to keep up with the rebalancing portfolio, such a pool has to pay its LPs more than 4.5% a year in fees. Real losses run a bit lower, because an arbitrageur only steps in when the price gap exceeds the fee, and because the network produces blocks at intervals rather than continuously.

You can use this estimate to judge up front whether a pool makes sense. Take an ETH/USDC pool with a 0.05% fee tier holding $20 million and seeing $10 million in daily volume. Fees bring in $5,000 a day, about $1.8 million a year, or roughly 9% of the pool's value. That's twice the LVR estimate, so LPs come out ahead. If daily volume falls to $2 million, fees drop to about 1.8% a year, and the pool starts losing to the rebalancing portfolio even though the interface still shows a positive yield.

:::p{html} How people try to fight it :::

Since LPs' money is flowing to arbitrageurs, newer designs try to win it back. Dynamic fees built on V4 hooks raise the rate when the market is moving, which makes arbitrage more expensive. CoW AMM settles pool trades in batches through an auction, so the surplus that used to go to the arbitrageur stays in the pool. Other projects auction off the right to make the first trade against the pool in each block and pass the proceeds to LPs. None of these approaches has become standard yet, so LVR remains the biggest hidden cost for a passive LP.

:::p{html} Yield Basis: leverage against the loss :::

The most unusual answer to impermanent loss comes from Curve founder Michael Egorov. His protocol, Yield Basis, has been live on Ethereum since fall 2025 and started with bitcoin. The idea builds on the same formula from the start of this section. A position in a regular pool is worth 2√(k × p), so it grows with the square root of the price, while simply holding the asset grows linearly, and the gap between the square root and the straight line is impermanent loss. Put 2x leverage on the position and the square root effectively gets squared, so the value becomes linear in price again.

In practice, you deposit, say, BTC, and the protocol borrows an equal value in the crvUSD stablecoin, puts both tokens into a Curve pool, and holds the resulting LP tokens as collateral against that debt. The docs give an example of a position of 1 BTC plus $100,000. When BTC goes from $100,000 to $150,000, the position grows from $200,000 to $250,000, just as with simple holding, whereas a regular pool position would come to about $244,949. On top of that, the LP earns the pool's fees, and on twice the liquidity.

The clever part is keeping leverage at exactly 2x, because when the price moves, the debt stays the same while the collateral gains or loses value. For that there's a separate pool, LEVAMM, which quotes a price matching the oracle only when leverage equals two. As soon as leverage drifts, the quote moves away from the market, and arbitrageurs, profiting from that gap, push the leverage back into place themselves. There's no need for keeper bots or scheduled transactions, but the LPs themselves pay for the rebalancing.

The loss doesn't disappear for free; it turns into other costs. Auditors at Statemind describe the position's return as twice the pool's yield minus the borrowing rate minus the cost of maintaining leverage. During sharp price moves, rebalancing can lag, and then costs go up. There's systemic risk as well. The protocol needs a lot of crvUSD, and in February 2026, with the stablecoin's peg under pressure, the Curve DAO added an emergency role that can temporarily pause Yield Basis pools. According to DefiLlama, the protocol held about $124 million in liquidity as of October 21, 2026, down from about $220 million in February. We'll go through the detailed math behind models like this in card 6.2. :::

:::further{label="Further Reading"}

:::quiz{id=q-5-5-s5 label="Check yourself" correct=2 explanation="Impermanent loss depends on the price ratio when you exit compared with when you entered. If the ratio is back where it started, the makeup of your share is too, so the gap with simple holding is gone and the fees stay with you. That's a rare lucky case, though, since nothing forces the price to come back."} You put ETH and USDC into a V2 pool. ETH drops by half, then a month later climbs back to its starting price, and you exit the pool. What's your impermanent loss?

  • 5.7%, because the 50% drop already happened along the way
  • 11.4%, because the losses from the fall and the rise add up
  • Near zero, since the price came back and you keep the fees
  • 50%, exactly as much as ETH fell during that month :::

:::section{mins=9} Aggregators and intents :::

:::lead An aggregator hunts for the best price across dozens of pools at once and can split your trade between them. As of September 2026, Jupiter, the largest aggregator on Solana, handled $15.5 billion over 30 days. :::

:::p Remember how in §2 buying 10 ETH from a single pool pushed the average price up 11%? Now imagine the same ETH spread across twenty pools on different DEXs. If you take a little from each, no single pool moves much, and your average price comes out better. That's the job of an aggregator. :::

:::p You type in "10 ETH to USDC," and the aggregator checks pools on Uniswap, Curve, PancakeSwap, and elsewhere, factors in the gas for every extra hop, and hands you a route. It might send 60% of the trade through one pool and 40% through another, with part of it going through an intermediate token. On EVM chains the well-known names are 1inch and 0x (whose interface is called Matcha). On Solana the main aggregator is Jupiter, although in 2026 its share shrank noticeably under pressure from OKX and DFlow. :::

:::p The next step is called intents. A classic aggregator works out the route in advance, but while the transaction waits its turn, prices can move and the route goes stale. With an intent system you don't sign a transaction. You sign an order along the lines of "I'll give 10,000 USDC and want at least 3.2 ETH." Then executors, called solvers or resolvers, compete to fill it best. The winner submits the transaction and pays the gas, but bakes that cost into the rate it offers you up front, so the swap doesn't become free. UniswapX, 1inch Fusion, and CoW Swap all work this way. :::

:::p{html} CoW Swap adds one more idea on top. The protocol groups orders into a batch and first looks for a coincidence of wants. If, in the same batch, Alice is swapping USDC for ETH and Bob is swapping ETH for USDC, their orders can be matched directly, with no trade against an outside pool. There isn't always a matching order, and when there isn't, the solver fills the rest from regular pools. Within a batch every token has one clearing price for everyone, so nobody can profit by reordering the trades. That protects you from the ordinary sandwich attack, which we'll cover in 5.6, though it doesn't guard against every kind of MEV. :::

:::callout A tailor needs ten meters of linen for a suit. The nearest supplier sells linen, but after the first four meters raises the price on every additional one. An experienced tailor calls around five shops, takes four meters from one, three from another, the rest from a third, and keeps in mind that every extra trip costs gas money. In the end each meter comes out cheaper than if he'd bought it all in one place. And sometimes he gets even luckier. The atelier next door happens to want to offload some spare linen and find wool, which the tailor has plenty of, so they swap directly without setting foot in a shop. :::

:::keypoints{label="Key Points"}

  • An aggregator doesn't create new liquidity; it makes better use of what already exists. The more fragmented the market is across chains, venues, and pools, the more useful it becomes.
  • Intents change who carries the execution risk. You only set the result you'll accept, and finding the route, paying gas, and dealing with price moves during execution become the executor's problem.
  • Competition among executors protects users only as long as there are several of them. If one participant ends up filling nearly every order, you're once again relying on the honesty of an intermediary, just a different one.
  • For small amounts, a direct swap in a large pool and an aggregator give almost the same result. The difference becomes noticeable once your trade is comparable to the depth of an individual pool. :::

:::details{badge=Advanced title="How aggregators and solvers actually execute a trade"} :::p{html} How an aggregator builds a route :::

To an aggregator, the market looks like a graph, with tokens as nodes and pools as edges. Between two popular tokens there can be hundreds of pools and thousands of paths through intermediate tokens, and price impact in each pool is nonlinear. Finding the exact best route at that scale takes too long, so aggregators rely on heuristics. They pick a handful of the deepest pools, split the trade into pieces, try different proportions, and account for gas on each piece, converted into the token being traded.

Before showing you a quote, the aggregator simulates the transaction against the current state of the chain and checks that the result matches its calculation. But the transaction executes seconds or minutes later, and if someone has moved the price in one of the pools in the meantime, the calculation is already off. The only safeguard is the minimum amount you'll receive, and if it isn't met, the transaction reverts. That's why aggregators are judged not by how nice their interface looks but by how many tokens users actually received on average across thousands of trades.

When comparing quotes from different aggregators, look at what you'll receive after all costs, not at the rate in big type. Some interfaces show gas separately, others have already subtracted it from the total, and market makers' quotes last only a few seconds and may be gone by the time you sign. If a route goes through unfamiliar pools or tokens you didn't expect, it's better to simplify the trade, even at a slightly worse rate. On trades of a few hundred dollars, the difference between aggregators is usually smaller than the cost of a single mistake.

:::p{html} How the auction works in intent systems :::

Intents shift who carries the execution risk. The user sets a minimum result, and if the price moves, the executor either still meets it or the order simply doesn't fill. Each system runs its auction differently. In UniswapX, an order first goes into a short sealed-bid quote auction, and the winner gets the exclusive right to fill it, which on Ethereum lasts about 24 seconds, or two blocks. If the winner doesn't make it in time, a Dutch auction starts, in which the price for the user gradually slides from favorable down to the minimum, and the first executor that finds the trade profitable takes it.

1inch Fusion also uses a Dutch auction, but only vetted resolvers who hold staked 1INCH tokens can fill orders. CoW Swap works differently. It collects orders into a batch, solvers then submit solutions for the whole batch at once, and the winner is whoever delivers the biggest surplus to users above their minimum prices. In all three systems the executor pays the gas but prices it in, and if a trade fails, the user loses nothing.

:::p{html} Who solvers are :::

Solvers aren't some abstract executors. They're teams that work as an aggregator, a market maker, and a bit of an MEV bot all at once. Barter, one of the large solvers on Ethereum, is a good example. When it gets an order, it searches for a route across more than 40 liquidity sources, including AMM pools, other aggregators, lending pools, and private quotes from market makers like Wintermute. Then it submits the transaction itself in a way that keeps bots from intercepting it. According to the team, more than $33 billion had gone through Barter by early 2026, and a sizable share of CoW Swap's flow is filled through private quotes.

This shows clearly that an intent isn't a pricing formula but a way of executing a trade. A solver takes the price wherever it's best, whether that's a pool, an order book, or a market maker's own balance sheet. The downside is concentration. If two or three solvers win most auctions, users are once again dependent on a small group of intermediaries, just more technically sophisticated ones.

:::p{html} How the market is changing :::

Aggregation is also changing the structure of the market itself. On Solana, Jupiter has routed more than $1.28 trillion since launching in 2021, but by the end of August 2026 its daily share among the chain's aggregators had fallen to 68%, and on some days OKX took up to 37% of volume. The more traffic flows through aggregators and solvers, the less users know about which venue actually filled their trade, and the more DEXs themselves turn into liquidity sources for intermediaries. For users this is mostly good news, because intermediaries compete on execution price. :::

:::further{label="Further Reading"}

:::quiz{id=q-5-5-s6 label="Check yourself" correct=3 explanation="A sandwich attack relies on trade order: a bot buys before you, you buy at a higher price, and the bot sells after you. In a CoW Swap batch a token has a single clearing price for every participant, so the execution order stops mattering. On top of that, orders don't land in the public transaction queue where bots usually watch for them. This protects you from sandwiches specifically, not from every form of MEV."} Why can't a bot run a sandwich attack on your trade inside a CoW Swap batch?

  • CoW Swap only lets in large traders, and bots fail its screening
  • Each trade in the batch executes with its own separate slippage
  • The protocol blocks the addresses of all known bots on Ethereum
  • A token has one price per batch, so trade order doesn't matter :::

:::section{mins=9} CEX or DEX: which one to use when :::

:::lead CEXs and DEXs complement each other more than they compete. A CEX is the easy way in from fiat and the place to trade liquid pairs against a deep order book, while a DEX lets you keep your assets in your own wallet and trade any token you like. :::

:::p Arguing over whether Binance or Uniswap is better is like arguing over whether a train beats a bike. It depends on where you're going. The clearest way to compare them is task by task. :::

:::p{html}

TaskCEXDEX
Buy crypto with fiatYes, the main routeOnly through a built-in third-party service
Large BTC or ETH tradeDeep order book, tight spreadPossible, best done through an aggregator
New or small-cap tokenOnly after listingAs soon as a pool is created
Perpetual futuresYesYes, on Hyperliquid and others
Custody of assetsThe exchange holds them for youYou do for swaps; deposit-based venues hold them in a contract
Sign-up and KYCRequiredNot needed for the contract, though front ends may restrict access
Connection to DeFiNoYes, tokens work in other protocols right away
:::

:::p{html} Most people buy stablecoins or ETH with fiat on a regulated exchange, withdraw them to their own wallet on the network where the protocol they want lives, which is often a layer 2 (2.5), and use DEXs and DeFi from there. Before you withdraw, make sure the exchange supports withdrawals to that exact network and that the tokens and protocols you need actually exist on it. Think of the exchange as the front door, not the place where you keep your money. We covered why you shouldn't leave funds on an exchange any longer than necessary in 5.4 §2. :::

:::p Perpetual futures tell a different story, because decentralized order-book exchanges have come close to CEXs on convenience. The biggest of them is Hyperliquid, and according to The Block, in May 2026 its volume reached 6.63% of futures volume across all CEXs for the first time. Market shares among perp DEXs swing a lot from month to month and depend on which exchanges get counted, so it's safer to check the exact figure for a specific date on DefiLlama. We'll get to leverage and liquidations in card 6.6. For now, just remember that a DEX stopped being only a place for swaps a long time ago. :::

:::p{html} DEXs still have weak spots, though. On volatile pairs like BTC and ETH, the order books of large CEXs are usually deeper for trades in the tens of millions, and DEX prices mostly follow CEX prices through arbitrage. On the other hand, a large stablecoin swap through a deep pool or a market maker's quote on a DEX can come out cheaper, so compare the final amount you receive after all fees. Permissionless listing also cuts both ways, since new tokens on DEXs are full of traps, from tokens you can't sell to classic rug pulls (4.3 §4). :::

:::callout Compare a city swimming pool with a lake outside town. The pool has a turnstile, a membership tied to your ID, opening hours and a lifeguard up on the chair. In return, the water is clean and the depth is painted right on the edge. The lake is open at any hour, nobody asks for papers, and you can swim to whichever shore you like. But there's no lifeguard, nobody has checked the bottom, and you'll find out where the snags are on your own. A seasoned swimmer goes to both. The pool is the easier place to learn and train, but only the lake lets you live by the water and swim wherever you want. :::

:::keypoints{label="Key Points"}

  • The main risk on a CEX comes from handing custody to an intermediary. On a DEX you're responsible for what you sign and which contracts you use, and the risks of the protocol's code and the tokens themselves remain on top. So keep money on an exchange for as short a time as you can, and on a DEX pay the closest attention to what you're signing.
  • Arbitrage ties DEX and CEX prices together, so any noticeable gap between them rarely lasts long. If a token looks suspiciously cheaper on a DEX than on an exchange, first check that it's the right token and that the pool has enough liquidity.
  • Moving perpetual futures onchain showed that decentralization was never what held order books back. Slow networks were the problem, and once fast enough chains arrived, the model worked without an intermediary.
  • Picking the wrong network or address when you withdraw from an exchange is just as irreversible as a mistake in a swap. When you send to a new address or a new network for the first time, start with a small amount. :::

:::details{badge=Advanced title="How to count volume and where perps are heading"} :::p{html} Why the numbers don't match :::

The ratio of DEX to CEX volume roughly tripled in under three years, but the figures depend heavily on who's counting. The Block records a high of 24.1% in July 2026. CoinGecko, using its own methodology, saw a peak of 24.5% back in June 2025 during the memecoin wave, after which the ratio fell back to 13–14%. To see where the gap comes from, you have to look at both the numerator and the denominator.

The denominator is CEX volume, and everything hinges on which exchanges are included. Count only large exchanges with verified reporting and the denominator shrinks, so the ratio goes up. Add smaller venues, some of whose volume is considered inflated, and the ratio drops. The numerator has its own problems, because bots generate a large share of DEX turnover, including arbitrageurs and sandwich attacks that push the same money back and forth. A trade routed through an aggregator is easy to count twice, once at the aggregator and once at the pool, which is why DefiLlama reports aggregator volume separately. Always check what went into the denominator and how the numerator was cleaned up.

:::p{html} What a trade really costs :::

For an ordinary user, the cost of a specific trade matters more than any volume ratio. Say you buy $3,000 worth of ETH. On a CEX you pay a trading fee, about 0.1% at many large exchanges, so roughly $3, plus a small spread and a withdrawal fee to your own wallet that depends on the network. On a DEX on a layer 2 you pay the pool fee, often 0.05% for ETH/USDC, so about $1.50, plus price impact and gas, which costs a fraction of a cent there. For a few thousand dollars in a liquid pair the difference is usually small, and what decides it isn't the fee but where you need the money next. For hundreds of thousands, depth decides it, and it's worth comparing the final amount in a large exchange's order book, in an aggregator and in a market maker's quote. Don't forget the trip back, either. If you later need to cash out to fiat, you'll pay another exchange fee plus the withdrawal to your card, and the savings from a cheap swap can disappear.

:::p{html} Perps on DEXs :::

In futures the gap is still wider. By CoinGecko's count, the ratio of perp DEX volume to CEX perp volume peaked at 12% in November 2025, driven by airdrop farming on Lighter and Aster, when traders pumped up their turnover to qualify for future rewards. Decentralized perp volume then dropped noticeably, which nicely illustrates how incentives inflate the statistics.

Hyperliquid kept its lead thanks to a different model. It's a standalone blockchain where the order book and the matching engine run at the level of the network itself, so orders execute almost as fast as on a CEX. The HIP-3 upgrade let outside teams launch their own markets on Hyperliquid if they stake 500,000 HYPE. The market creator picks the price source and earns a share of the fees, and if the market breaks because of the creator's mistake, validators can vote to burn part of the stake. That's how stock and commodity futures appeared on Hyperliquid, and in May 2026 more than $62 billion went through these markets.

:::p{html} The line is blurring :::

Meanwhile, the line between the two is blurring from both sides. Centralized exchanges are building onchain trading right into their apps, so a user can buy a token from a pool on Base or Solana without leaving a familiar interface. The OKX aggregator already competes with Jupiter for swaps on Solana. DEXs, for their part, are catching up with CEX convenience through intents, gas abstraction and sign-in with an email or password instead of a seed phrase.

For you, this means the key question will no longer be CEX versus DEX. What matters is knowing who holds the money in each specific trade and who can freeze it. If the tokens sit in your wallet and a contract executes the trade, that's the onchain model, even if the button lives in an exchange's app. If the exchange is the one showing your balance, that's custody with an intermediary, even if the trade is later routed to a DEX. :::

:::further{label="Further Reading"}

:::quiz{id=q-5-5-s7 label="Check yourself" correct=0 explanation="A pool contract only accepts tokens, so money from a card first has to become a crypto asset through an exchange or a fiat on-ramp. Withdrawing straight to Base saves you a separate bridge, as long as the exchange supports that network. A DEX liquidity pool needs the tokens to sit in your own wallet. You can't enter a pool from an exchange account, and the only thing you can send to a pool's address is tokens."} You want to buy €500 of ETH with a bank card and put it into a liquidity pool on Base. Which route makes the most sense?

  • Buy ETH on a CEX and withdraw it to your wallet directly on Base
  • Pay by card straight into the pool contract on Base and let it buy ETH
  • Keep the ETH on the exchange and add liquidity from your exchange account
  • Send the euros by bank transfer straight to the liquidity pool's address :::

:::section{mins=10} The DEX map: who owns which niche :::

:::lead Every major DEX has its own niche. Uniswap is the all-rounder, Curve holds the stablecoin market, PancakeSwap leads on BNB Chain, and Aerodrome and Velodrome merged into Aero on October 22, 2026, which now runs on seven networks at once. :::

:::p Why are there so many DEXs if Uniswap's spot volume is bigger than the next three combined? Liquidity gravitates toward a particular network and a particular type of asset, and each niche has grown its own venue: :::

:::p{html}

  • Uniswap. The general-purpose DEX for any ERC-20 token across more than 40 networks, and the leader in spot volume.
  • PancakeSwap. The main venue on BNB Chain and the second-largest spot DEX by volume, which has overtaken Uniswap in some months. According to CoinGecko, in June 2025, riding a wave of BNB Chain token trading, it took 64.5% of volume among the major DEXs.
  • Curve. Pools for stablecoins and tokens that trade at the same price, like USDC and USDT or ETH and stETH, built on the StableSwap formula. Curve's volume is more modest, but it remains one of the cheapest places to swap millions between stablecoins.
  • Aero. The merger of Aerodrome, the largest DEX on Base, and Velodrome on OP Mainnet. Together they account for about 17% of spot volume across EVM networks, and the unified protocol went live on seven networks on October 22, 2026.
  • Solana. Trading here happens on Meteora, Raydium and Orca, with the Jupiter aggregator sitting on top and handling most of the network's swaps.
  • Hyperliquid. Its own blockchain with an order book, and the leader in perpetual futures among DEXs.
:::

:::p So where should a beginner start? For everyday swaps on EVM networks, Uniswap or an aggregator is enough, on Solana it makes sense to start with Jupiter, and for large stablecoin swaps Curve is the right fit. Don't become a liquidity provider until you've worked through §5, and it's better to leave perp DEXs until card 6.6. :::

:::p One more thing to keep in mind is copycats. Every popular DEX has dozens of forks with similar names and logos, sometimes on the same networks. Before you connect your wallet, check the site address against your bookmark or the project's official page, not a search ad. :::

:::callout A symphony orchestra sounds like a single whole, but every instrument has its own part. The violins carry the melody almost the whole time, the timpani sit silent for forty bars and come in only at the climax, and nobody hears the double bass on its own, yet without it the sound falls apart. The conductor never asks the trumpet to play the harp's part. The DEX map works the same way. Uniswap carries the main melody on almost every network, Curve holds a steady low end for stablecoins, Aero plays loudest on its home stage of Base, and the aggregator acts as the conductor, deciding in every trade who comes in. :::

:::keypoints{label="Key Points"}

  • Liquidity attracts liquidity. A large DEX offers better prices, traders come to it, liquidity providers follow them, and that's why it's so hard to challenge the leader on its home network.
  • The type of asset shapes a DEX's niche as much as the network does. Stablecoin swaps, trading new tokens and futures each need different mechanics, and no single leader dominates all three.
  • In ve models, a DEX token becomes a tool of influence. Whoever holds the votes decides where rewards go, so protocols are willing to pay for those votes to pull liquidity into their pools.
  • Ranking high on volume guarantees neither safety nor the best price for your trade. The depth of the specific pool sets the price, so before a swap it matters more to compare quotes than to pick the best-known venue. :::

:::details{badge=Advanced title="ve models, liquidity wars and what they cost"} :::p{html} How veCRV works :::

In 2020 Curve came up with the vote-escrow model. A holder locks CRV tokens for anywhere from a week to four years and receives veCRV in return. The longer the lock, the more votes you get. Locking for four years gives you 1 veCRV per 1 CRV, and from there the voting weight decays linearly as the unlock date approaches. You can't sell veCRV, and you only get your CRV back when the lock expires.

Votes give you the right to decide each week which pools receive the emissions of new CRV, and those rewards are exactly what draws liquidity into the pools. On top of that, veCRV holders get a share of protocol fees, and if they provide liquidity themselves, boosted rewards of up to 2.5x. For a stablecoin protocol, a deep pool on Curve meant its token held its peg and swapped easily into USDC, so the votes were worth fighting for.

:::p{html} The Curve Wars and the market for votes :::

Protocols started buying up CRV and locking it, then realized it was cheaper to rent the votes. That's how Convex appeared. It pooled users' CRV, locked it permanently, voted on their behalf and gave them its own tokens in return. By 2022 roughly half of all veCRV was voting through Convex. The next layer was bribe platforms such as Votium, where protocols openly paid Convex vote holders to vote for their pool.

Stake DAO became the second major player. It introduced liquid lockers, where the protocol locks CRV permanently and gives the user an sdCRV token that can be transferred, sold and used in other DeFi protocols. This fixes the most awkward thing about veCRV, since a locked token can't be withdrawn before the lock ends, while sdCRV can be sold on the market at any time, though sometimes at a discount to CRV. According to the team, about 120 million veCRV was voting through Stake DAO in spring 2026. The same setup works for Balancer, Frax, Pendle and other protocols with a ve model.

Stake DAO also runs its own vote market, Votemarket. A protocol that needs liquidity posts a reward for votes in favor of its pool, and vote holders choose for themselves which offers to vote for. All of it happens in contracts and in the open, so anyone can see the price of a vote. For an ordinary CRV holder, these intermediaries turn governance into a source of income, but along with the vote they also give up part of their influence over the protocol, since in practice whoever pays the most is the one voting.

If a week of emissions to a pool is worth, say, $100,000 in rewards, a protocol comes out ahead paying any smaller amount for the votes it needs. The market sets the price of a vote, and at the peak of the fight protocols usually got more than a dollar of emissions for every dollar of bribes. This race went down in history as the Curve Wars.

:::p{html} ve(3,3) and what Aero changed :::

Velodrome, and later Aerodrome, built on this idea with the ve(3,3) model. Here a week is called an epoch, and at the end of it voters receive all the fees and incentives from the pools they voted for, while liquidity providers receive the emissions. That makes it pay to vote for pools with real trading activity, and it creates a loop where fees attract votes, votes direct rewards to pools, rewards attract liquidity, and liquidity generates new fees. Holders of locked tokens also receive part of the new emissions so their share doesn't get diluted. This is the model that made Aerodrome the largest DEX on Base.

In the merger into Aero, completed on October 22, 2026, AERO holders received 94.5% of the new token and VELO holders 5.5%. The split is based on revenue over the previous 52 weeks, $260 million for Aerodrome versus $15 million for Velodrome.

Along with the merger, Aero dropped the weekly vote that the ve(3,3) model was built on. Locked positions became sAERO, and rewards are now allocated continuously. sAERO holders point the rewards budget at pools they expect to generate revenue, and they earn a share of that revenue for as long as their allocation stands. A pool's rewards are counted in dollars and can be capped at a multiple of its projected revenue, and anything above the cap simply isn't minted. It's a direct answer to the main weakness of ve(3,3): emissions that pool activity doesn't pay for. The next few months will show whether the new design works.

It also follows that when a pool on a ve(3,3) exchange's site shows 200% APR, most of that number almost always comes from emissions of the exchange's token, not from trading fees. Rewards are paid in a token that's minted continuously and often sold right away by whoever receives it, so your real return in dollars depends on what that token is worth when you sell it. Only the part of the yield that comes from fees can be considered sustainable, and front ends usually show it on a separate line.

:::p{html} Weak spots :::

ve models have weak spots too. Rewards are paid in newly minted tokens, and if pool turnover can't keep pace with emissions, holders lose out to dilution. Liquidity that came for the rewards leaves with them, which is why it's called mercenary liquidity. Power also concentrates among whoever has accumulated votes, and a token locked for years can't be sold when the market falls.

The summer of 2023 shows this well. At the end of July, a bug in the Vyper compiler let attackers drain several Curve pools of tens of millions of dollars, and the CRV price fell sharply. That put at risk the large loans Curve founder Michael Egorov had taken out against CRV collateral on various lending protocols. Liquidating a position that size would have pushed the price down even further, so Egorov rushed to sell CRV to large buyers in over-the-counter deals to pay off his debts. A model where the value of votes rests on the price of a single token turned out to be fragile exactly when people were leaning on it the most. The protocol held up that time, but the episode explains well why investors judge ve models not just by yield but also by how concentrated the votes and the collateral are. :::

:::further{label="Further Reading"}

:::quiz{id=q-5-5-s8 label="Check yourself" correct=1 explanation="StableSwap keeps the curve almost flat near equilibrium, so even swaps worth millions between stablecoins barely move the price. For a trade like this it's still worth comparing the price through an aggregator, since Uniswap has deep USDC/USDT pools too. Hyperliquid, meanwhile, mostly trades futures, not spot stablecoins on Ethereum."} A DAO treasury needs to swap 2 million USDC for USDT on Ethereum with minimal slippage. Which venue was built specifically for swaps like this?

  • Hyperliquid, because it has the deepest order book around
  • Curve, whose StableSwap formula barely moves the price near $1
  • A fresh Uniswap V4 pool with an unfamiliar hook that changes fees on the fly
  • Any memecoin launchpad on Solana that charges the lowest fees :::