Skip to content
Buying, Selling & Execution

How a swap works

Trading against a liquidity pool, step by step.

Intermediate7 min readGeneral concept
In this lesson
  • Explain what happens when you buy from a pool
  • Understand why the price moves with your own trade
  • Know the difference between a quote and an execution

When you buy a token on a decentralised exchange, there is usually no seller on the other side. You trade against a liquidity pool: a contract holding the token and a currency. You put currency in and take tokens out.

What happens when you buy a token
  1. You signYour wallet signs: pay X USDC, receive at least Y tokens
  2. RouteThe order travels to the pool (directly or via a relay)
  3. PoolTakes your USDC, gives tokens at its current price
  4. BlockConfirmed — or reverted if you would get less than Y

Because the pool keeps a balance between its two reserves (in the simplest design, x · y = k), every purchase makes the remaining tokens more expensive. Your own trade moves the price — a little in a deep pool, a lot in a shallow one.

Liquidity and price impactSimulation · hypothetical numbers
Price before
$0.01
Average price you pay
$0.01
Price impact (incl. 0.3% pool fee)
+2.8%
Price left in the pool
$0.01

Constant-product pool (x · y = k), token priced at 0.01 USD. Real pools can use concentrated liquidity and several routes, but the lesson is the same: the smaller the pool, the more your own trade moves the price — on the way in and on the way out.

Quote
The estimate shown before you sign: how many tokens you should receive and the minimum you accept.
Execution
What actually happens when your transaction is included in a block. The price may have moved since the quote.
Key takeaways
  • Swaps trade against pools, not individual sellers.
  • Your own trade moves the price, more in shallow pools.
  • Quotes are estimates; execution happens in the block.

Check your understanding

Answers are checked on the server. You can retry as many times as you like.

  1. You buy a large amount in a small pool. What happens to the price you pay on average?
Reviewed Nov 6, 2026

Educational content only. Not financial, investment, legal or tax advice. Examples and simulators are hypothetical and simplified; they are not real market data or a prediction of results.