A swap changes a pool. Providing liquidity changes your exposure.
A swap button and an earn button can point to the same pool while doing different jobs. Follow an imaginary pool to see how smart contracts, a decentralized exchange and a liquidity provider fit together. The numbers below explain one simple model; they are not quotes or expected returns.
What the exchange actually executes
DeFi describes financial applications built with blockchain protocols. A decentralized exchange is one application: its smart contracts enforce the settlement rules. The website collects your choices, but the called contract determines whether the proposed exchange is allowed. A familiar logo does not establish which contract a wallet prompt will call.
An automated market maker replaces a conventional list of buyers and sellers with a pricing rule and available reserves. In a simple constant-product liquidity pool, the reserve quantities x and y follow x × y = k before fees. Buying one asset leaves less of it in the pool and more of the other. That changes the next quoted price. Different AMMs use other designs, and concentrated-liquidity positions have additional range rules.
A depositor owns a changing mixture
The swapper exchanges assets. A liquidity provider contributes assets that other people trade against, receiving a claim on the position under the protocol's accounting rules. Those are different exposures. A fee rate describes charges on trades; it does not promise the provider a fixed yield.
Impermanent loss compares the position with simply holding its original assets. It is not a separate fee charged at withdrawal. A position can rise in dollar value while still falling behind that holding benchmark. Fees may offset the difference or may fail to do so. Contract defects, token behavior and changing market conditions create other risks that this comparison does not measure.
One pool, two different comparisons
Imagine a full-range pool containing 100 units of token A and 100 units of token B. Initially each is worth one imaginary dollar. Ignore fees, deposits, withdrawals and rounding. The product is 10,000. Later A's external price becomes four B per A, while B stays at one dollar. Trades that align the pool with that relative price leave 50 A and 200 B: the product remains 10,000 and the reserve ratio is four.
The pool now has a value of $400. Holding the original 100 A and 100 B would instead be worth $500. The pool gained $200 from its starting value, yet trails the holding benchmark by $100, or 20% of $500. A provider with a constant 1% share would compare $4 with $5. This deliberately simplified example isolates the effect of the changed price ratio, not a forecast for a real pool.
| Position | At the new prices |
|---|---|
| Pool reserves | 50 A × $4 + 200 B × $1 = $400 |
| Original assets held separately | 100 A × $4 + 100 B × $1 = $500 |
| Difference relative to holding | ($400 − $500) / $500 = −20% |
Check your understanding
If the pool is worth more than at deposit, does that rule out impermanent loss?
No. The comparison is with holding the original assets at the same later prices, not with the original dollar deposit. Both the pool's value and the holding benchmark can increase by different amounts.
Check the primary sources
These references explain the rules behind the lesson. The examples above are fictional teaching scenarios written for this dictionary.