Intermediate · Lesson 10
Liquidity pools, DEXs and bridges
A DEX has no order book and no custodian. It has a contract, a pool and a price curve. The trade-offs follow from that.
A decentralised exchange has no queue, no clerk and no order book. It has a contract holding two assets and a rule for pricing one against the other. Anyone can trade against that contract, and the people who deposited the assets are the counterparty.
The pool is the market maker
A liquidity pool holds at least two assets. Providers deposit them in a ratio and receive shares of the pool. Traders pay a fee that stays in the pool, so shares become redeemable for slightly more than deposited — if the assets have not diverged.
The price is the ratio of the reserves. If a pool holds 10 ether and 20,000 dollars, the quoted price is 2,000 dollars per ether. Nobody sets that number; it is arithmetic. When the market price moves, arbitrageurs trade against the pool until the ratio catches up, and that arbitrage is what transmits the outside price into the contract.
A DEX can also be an on-chain order book or an aggregator that splits an order across pools. Settlement is a transaction, not a promise from a broker.
Worked example: impermanent loss
Suppose you deposit 1 ether and 2,000 dollars when ether trades at 2,000 dollars. The pool holds 1 × 2,000 = 2,000 units of product, and your share is the whole pool here.
Ether then doubles to 4,000 dollars. Arbitrageurs buy the cheap ether until the pool's ratio matches the market. The new reserves satisfy both the invariant and the price:
rETH × rUSD = 2,000 rUSD / rETH = 4,000 => rETH = 0.7071, rUSD = 2,828.43
Your position is now 0.7071 ether and 2,828.43 dollars. At the new price it is worth 0.7071 × 4,000 + 2,828.43 = 5,656.85 dollars. Simply holding 1 ether and 2,000 dollars would give 1 × 4,000 + 2,000 = 6,000 dollars. The difference is 343.15 dollars, or 5.72%.
That is impermanent loss: the pool's rebalancing sold ether on the way up and bought it on the way down. It is impermanent only while you stay; it becomes permanent when you exit. The general formula for a price ratio r is:
IL = 2 × √r / (1 + r) − 1
For r = 2, that is 2 × 1.4142 / 3 − 1 = −5.72%. For r = 4 it is −20%. The loss is symmetric: a halving produces the same −5.72%.
| Price ratio | Loss versus holding |
|---|---|
| ×4 | −20.0% |
| ×2 | −5.7% |
| ×0.5 | −5.7% |
| ×0.8 | −0.6% |
Fees can cover it. If the pool earned fees equal to 0.5% of your position over the period, the net result is −5.22% versus holding, before gas. Whether that is acceptable depends on volume, fees and time. The example is illustrative; the arithmetic is the point.
Bridges: the claim travels, not the asset
A bridge moves value from one chain to another. It cannot move the native asset itself, because the two chains do not share state. Most designs lock the asset on the source chain and mint a representation on the destination, or burn on the source and release from a reserve on the destination. A third design runs a liquidity network: a provider fronts you the asset on the destination and is repaid on the source.
The representation is a claim on the bridge, not the asset. If the bridge is exploited, the native asset on the source chain can be perfectly fine while the wrapped version on the destination goes to zero.
Bridges concentrate risk because one contract, or one validator set, controls the assets for every user. A bug or a compromised key does not affect one position; it affects the pool of everything locked. That is also why bridges have been a repeated target: the prize is the contract's balance, not a single trade.
Bridging arithmetic is simple and the risk is not. Suppose you bridge 1,000 dollars, the bridge charges 0.1% and the source-chain gas costs 2 dollars. You receive 1,000 − 1 − 2 = 997 dollars of the wrapped asset. The 3 dollars is the visible cost. The invisible cost is the trust you extend to the bridge's keys, validators and code while you hold the claim.
What to check before you deposit or bridge
- For a pool: the fee tier, the depth at the price you need, the quality of both assets, the divergence risk and the contract's age. TVL is not depth; a large pool can still move sharply if it is concentrated in one range.
- For a DEX: the route, the slippage tolerance, the approvals you sign and whether the interface is the canonical one. An aggregator can give a better average price and still route through a pool you would not choose.
- For a bridge: who can move the assets, how many signatures are required, whether the contract is upgradeable, how withdrawals are delayed and what happens if the destination chain stalls.
- For all three: the asset you receive may be a claim on a claim. Read the contract address and the issuer, not the ticker.
A bridge is a custodian for an asset it did not issue. The question is not whether it calls itself decentralised, but who can move the assets and what happens if they do.
Check yourself
- Ether doubles and the pool rebalances. Why is the LP's position worth less than simply holding the two assets?
- You bridge 1,000 dollars with a 0.1% fee and 2 dollars of gas. What do you receive, and what are you actually holding afterwards?
- Why can a bridge exploit be worse than a DEX exploit of the same size?
The vocabulary — liquidity pool, impermanent loss, bridge, DEX aggregator — is in the glossary. AMMs derives the curve behind the pool, and Staking and DeFi places the fee yield in the wider picture.