Trail notes
- A decentralized exchange (DEX) lets you swap tokens through smart contracts instead of a company holding your funds.
- Most DEXs use automated market makers: pools of two tokens priced by a formula rather than an order book.
- Bigger trades against smaller pools move the price more; that is price impact. Slippage is the gap between the quote and what you actually get.
- Liquidity providers deposit tokens, receive LP tokens and earn a share of trading fees, while taking on impermanent loss and code risk.
Order books vs automated market makers
A traditional exchange uses an order book: buyers post bids, sellers post asks, and a trade happens when they match. This works well when many active traders and market makers are present, but it is expensive to run entirely on a blockchain, where every order update costs a fee.
Most DEXs instead use an automated market maker (AMM). Rather than matching you with another person, you trade against a liquidity pool, a smart contract holding two (or more) tokens. A formula decides the price based on how much of each token is in the pool. Anyone can add tokens to the pool and earn fees for doing so.
| Order book | AMM liquidity pool | |
|---|---|---|
| Who you trade with | Another trader’s order | A pool of tokens |
| How price is set | Best matching bid and ask | A formula based on pool balances |
| Who provides liquidity | Market makers posting orders | Anyone who deposits into the pool |
| Main cost to you | Spread and fees | Fees plus price impact |
The constant-product idea: x × y = k
The simplest and most widely copied AMM formula is the constant product. If a pool holds x units of one token and y units of another, the contract only accepts trades that keep x × y equal to a constant, k (before fees). The price is simply the ratio of the two balances.
The pool never runs out of either token, because each extra unit costs more than the last. That is the design’s strength and its cost: the formula always offers a price, but large trades get progressively worse prices.
Arbitrage keeps the pool’s price in line with other markets. If the pool’s Token A is cheaper than elsewhere, traders buy it from the pool until the price rises back. That same process is what causes impermanent loss for liquidity providers.
See the full infographic with notes.
Price impact and slippage
People often use these terms interchangeably, but they mean different things:
- Price impact is how much your own trade moves the pool’s price. In the example, the 1,000-stablecoin trade cost about 1% more than spot; the 10,000-stablecoin trade cost about 10% more. Impact depends on trade size relative to pool size.
- Slippage is the difference between the price you were quoted and the price you actually got, caused by other trades landing first while yours waits to be confirmed.
- Slippage tolerance is a setting you choose. If the final price would be worse than your tolerance allows, the trade fails instead of filling badly.
Most swap screens show a “minimum received” amount based on your slippage tolerance. That number, not the headline price, is the worst outcome you have agreed to. A very wide tolerance invites bots to trade just before and after you at your expense.
Gas fees sit on top of all this. On a busy network a small swap can cost more in fees than it saves. Our guide to gas fees explains how those are set.
Becoming a liquidity provider: LP tokens and fees
To add liquidity, you deposit both tokens in the pool’s current ratio. In return you receive LP tokens, a receipt that represents your share of the pool. When you withdraw, you return the LP tokens and receive your share of whatever the pool holds at that moment, which may be a different mix from what you put in.
Each trade pays a fee, a small percentage set by the pool, that stays in the pool and grows the value behind each LP token. Some pools also pay extra reward tokens; we cover that in liquidity mining.
LP tokens are themselves tokens. They can be lost, stolen or approved to the wrong contract, and treating them carelessly is a common way people lose a position. See wallet approvals and signing.
Risks and the Canadian angle
- Fake tokens: anyone can create a pool for a token with a familiar name. Always confirm the contract address.
- Thin pools: low liquidity means heavy price impact and easier manipulation.
- Impermanent loss: providers can end up worse off than simply holding.
- Smart contract risk: the pool and any router you use are code that can fail.
- Front-running: bots can see pending trades and position around them.
The CRA lists trading one crypto-asset for another as a disposition, so each swap can create a capital gain or loss, or business income, depending on your situation. As of 2026-10-30, the CRA has published no DeFi-specific guidance on liquidity pools or LP tokens. Keep records of every swap, deposit and withdrawal. See crypto dispositions and record keeping.
If you would rather trade through a registered intermediary, our CEX vs DEX comparison sets out the trade-offs side by side.
Your checklist
Questions people ask
What is a liquidity pool?
A liquidity pool is a smart contract holding two or more tokens that traders swap against. A formula sets the price from the pool’s balances, and the people who deposited the tokens earn a share of the trading fees.
What does x*y=k mean?
It is the constant-product rule used by many automated market makers: the pool’s two token balances multiplied together must stay the same after a trade, before fees, so buying one token makes it progressively more expensive.
What is the difference between slippage and price impact?
Price impact is how much your own trade moves the pool’s price, based on its size versus the pool. Slippage is the extra difference caused by other trades executing before yours is confirmed.
Is swapping tokens on a DEX taxable in Canada?
It can be. The CRA treats trading one crypto-asset for another as a disposition, which may produce a capital gain or loss or business income. As of 2026-10-30 the CRA has no DeFi-specific guidance on liquidity pools.
Sources and dates
- Decentralized finance (DeFi) — ethereum.orgreference
No date shown on page · checked 2026-10-31. Overview of DeFi building blocks on Ethereum. - Gas and fees — ethereum.orgreference
No date shown on page · checked 2026-10-31. How transaction fees (gas) work on Ethereum. - Introduction to smart contracts — ethereum.orgreference
No date shown on page · checked 2026-10-31. What a smart contract is and how it executes. - Understanding crypto-assets and your tax obligations — Canada Revenue Agencyin force
No date shown on page · checked 2026-10-30. Defines crypto-assets; lists dispositions (sell, trade, barter, gift, gamble) and acquisitions including mining/staking rewards. - Reporting income from crypto-asset transactions — Canada Revenue Agencyin force
Page date 2025-12-02 · checked 2026-10-30. Business income vs capital gains is case by case; lists business indicators; crypto-to-crypto trades are dispositions; half of a capital gain is taxable. - Keeping books and records of crypto-assets for tax filing — Canada Revenue Agencyin force
Page date 2025-11-10 · checked 2026-10-30. What to record per transaction, wallet addresses, yearly balances; export platform history; keep records at least six years.
Education only. Nothing on this page is financial, investment, tax or legal advice, or a recommendation to buy, sell, stake, lend or borrow any crypto-asset. Crypto-assets can lose some or all of their value and are not covered by CDIC. Canadian rules change: check the dated sources above and talk to a qualified professional about your situation. Full disclaimer.
