Hexncoin

💱 DeFi & Tokens

DEXs & Liquidity Pools

How you can swap tokens with no order book and no broker.

7 min read

Swapping without a counterparty

A traditional exchange matches a buyer with a seller. A decentralized exchange (DEX) often skips the match entirely. Instead, you trade against a pool of tokens held by a smart contract - an automated market maker.

Liquidity providers deposit two assets into the pool. A formula (classically x · y = k) sets the price based on the ratio in the pool. Your swap shifts that ratio, which is why large trades move the price - an effect called slippage.

Where the yield comes from

Every swap pays a small fee that goes to the liquidity providers. That's their reward for supplying the assets others trade against.

But providing liquidity isn't risk-free. If the two assets' prices diverge, a provider can end up worse off than simply holding them - a phenomenon called impermanent loss.

More liquidity in a pool means less slippage - big trades barely move the price when the pool is deep.

Check your understanding

3 questions from this lesson, with the correct answer already marked.

1. On an AMM-based DEX, who is your trade matched against?

  • Another individual trader
  • A liquidity pool held by a smart contract
  • A central bank
  • A broker

You trade against a pool of assets priced by a formula, not against a matched counterparty.

2. Why do large trades move the price on an AMM?

  • The exchange charges more for big trades
  • They shift the ratio of assets in the pool, which sets the price
  • Validators vote on each price
  • Gas fees change the price

Price comes from the pool ratio, so a big swap changes that ratio - the effect known as slippage.

3. How do liquidity providers earn a return?

  • A share of the swap fees
  • Interest from a bank
  • Mining rewards
  • Government subsidies

Each swap pays a fee that is distributed to the pool's liquidity providers.