Skip to content
Hexncoin
Track 4: DeFi & TokensLesson 2 of 3·7 min

DEXs & Liquidity Pools

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

01

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.

02

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.

Remember

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

Concept map · schematic

What a swap actually consumes

Available depth along the execution route—not headline TVL—determines price impact.

  1. 01

    Trade size

    How much the user wants to exchange

  2. 02

    Available depth

    Executable liquidity at successive prices or bins

  3. 03

    Execution

    Output depends on fees, depth and route

Important: Pool TVL alone cannot determine slippage; request a fresh executable quote.

Self-check

Check your understanding

Choose an answer for each question, then check the results and explanations.

3 questions
Question 1

Question 1 / 3

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

Question 2

Question 2 / 3

Why do large trades move the price on an AMM?

Question 3

Question 3 / 3

How do liquidity providers earn a return?

Primary references

Documentation and standards

References added

Official technical references for further verification. A source link is not a guarantee that every earlier editorial sentence has been reverified; provider specifications may also change over time.

The curriculum predates this reference index. These sources are offered to check technical details; no original publication date has been inferred.

Apply what you learned

Related practical guides

Continue learning