← guides

How onchain liquidity works, and where the money is lost

the fee →whoever depositswhoever swaps
whoever deposits provides the liquidity, whoever swaps pays the fee that ends up with the depositors.

On one side, whoever deposits their coins into the pool and supplies its liquidity; on the other, whoever swaps and pays a fee on every swap. That fee is the only payment the depositor gets, and it has to be enough to cover the impermanent loss.

in short
A pool sets the price with a formula, with no need for buyers and sellers. Whoever puts their coins in collects the fees and pays the impermanent loss, and the second bill is often bigger than the first. Loans add liquidation on top, and three-figure yields almost always come from tokens printed for the purpose.

How does a pool make a price with no buyers and sellers?

With a formula. The most common model keeps the product of the two amounts in the pool constant: in an eth/usdc pool, the amount of eth times the amount of usdc always has to give the same number.

When somebody buys eth, the eth in the pool goes down and the usdc goes up. To keep the product fixed, the price the pool quotes moves by itself: the bigger the order, the worse the price gets as it fills. There’s nobody on the other side, no order book to keep up to date and no bid to wait for. It’s just you and a curve.

1 eth · 2,000 usdc0.707 eth · 2,828 usdc
a pool with 1 eth and 2,000 usdc: across, how much eth is left in the pool; up, how much usdc. buying eth slides the point along the curve.

In a pool that keeps the product of the two amounts constant, buying eth empties the eth side and fills the usdc side: the point slides along the curve and the price moves. After the price of eth doubles the pool holds 0.707 eth and 2,828 usdc, no longer 1 and 2,000.

Those are the advantages that made AMMs take off: you swap whenever you like, with no counterparty and no waiting. The costs come right after, and there are three of them. Slippage on large orders, which is the price moving while you buy. The sandwich attack, where somebody sees your order before it fills, buys ahead of you and sells right after. And impermanent loss, which hits the people who put money into the pool more than the people who swap, and is the biggest of the three.

Why can providing liquidity pay less than sitting still?

Because the pool rebalances itself, and rebalancing means selling what rises and buying what falls. The difference between what you would have just holding the coins and what you have holding them in the pool is called impermanent loss.

The clearest example is the classic one. You deposit 1 eth when it’s worth $2,000, plus 2,000 usdc, $4,000 in all. If eth doubles to $4,000, someone who just held the coins has $6,000. You, in the pool, have $5,657, because the arbitrage along the way left you with 0.707 eth instead of one. You’re $343 short, 5.7%.

$4,000 depositedheld still · $6,000in the pool · $5,657
the same starting capital, $4,000: what’s left holding the coins still, and what’s left leaving them in the pool. source: computed from 2√r/(1+r)−1.

With 1 eth at $2,000 and 2,000 usdc deposited, if eth doubles whoever held the coins still gets $6,000 and whoever put them in the pool gets $5,657. If eth halves, holding still gets $3,000 and the pool $2,828. Either way the difference is 5.7%.

If eth halves to $1,000 instead, someone who just held has $3,000 and you have $2,828: $172 short, 5.7% again. The formula is symmetrical, and that’s the takeaway. What hurts is how far the two prices drift apart, in either direction. The fees you collect are there to cover that gap, and if they don’t, you’ve been working for the pool for free.

When does the loss stop being impermanent?

It’s called impermanent because in theory it cancels out: if the price comes back exactly to where it was when you deposited, the difference disappears. In theory.

In practice prices almost never come back to where they started. And you have to stay in the pool long enough for the fees to fill the hole, while volatility keeps widening it. The further the two prices diverge, the bigger the loss, and it grows fast: a doubling costs 5.7%, a tripling 13.4%, a five-fold move 25.5%.

×1.25 · 0.6%×1.5 · 2.0%×2 · 5.7%13.4%×325.5%×5
what the divergence of the prices costs in a 50/50 pool, as the distance between them grows. source: computed from 2√r/(1+r)−1.

In a 50/50 pool the impermanent loss grows with the distance between the prices of the two coins: 0.6% if one moves a quarter against the other (×1.25), 2.0% at one and a half times (×1.5), 5.7% at a doubling, 13.4% at a tripling, 25.5% at five times.

The calculation to do before depositing is always the same, and it’s a subtraction: what the fees pay minus what the impermanent loss costs. If a pool pays 30% apr in fees and the price divergence costs you 40%, you’re losing money while staring at a green number. Most liquidity providers only look at the first number, because that’s the one printed large in the interface.

What actually reduces impermanent loss?

There are four ways, and two of them reduce nothing. They just move the problem somewhere else.
four roads, two that move the problem
strategyeffect on impermanent losswhat it asks in exchange
stablecoin poolsclose to zero lower fees
correlated coinsreduced the gap between the two stays
concentrated liquiditygreatest outside the band watching the price
token emissionsmade up, not reduced that the token holds its value
the four strategies, and what each one asks in exchange.

The four strategies for reducing impermanent loss: stablecoin pools take it close to zero in exchange for lower fees; pools of correlated coins reduce it but stay exposed to the gap between the two; concentrated liquidity raises the fees inside a price band and zeroes them outside it; token emissions make it up only while the issued token holds its value.

The first is pairing coins that don’t diverge. Two stablecoins pegged to the same dollar, like usdc, usdt or dai, almost never move apart, so the impermanent loss stays close to zero. The fees are lower, but the ones you collect you keep. The second is pairing coins that move together, like stETH and eth or wBTC and bitcoin. They’re not the same thing, but they go the same way, and the gap that opens between them is small.

The third is concentrated liquidity, which Uniswap introduced in version three. Instead of spreading your money across every possible price, you put it inside one band. The same capital works much harder as long as the price stays in there, and stops working entirely the moment it leaves. At that point you collect nothing and you’re left holding only the coin that lost. The fourth is having the protocol make up the impermanent loss in its own tokens, which works as long as the token is worth something. If it falls while you pile it up, you’ve swapped a certain loss for a bigger one.

What happens when you borrow against what you hold?

You put one coin up as collateral and borrow another, at a rate that rises and falls with demand. The ratio between the two is called LTV: deposit $10,000 of eth with a maximum LTV of 75% and you can borrow up to $7,500 of stablecoins.
collateral · $10,000liquidated · $8,500max loan · $7,500
with $10,000 of collateral: how much you can borrow, and at what debt they liquidate you.

With $10,000 of eth as collateral and a maximum LTV of 75%, the loan reaches $7,500. Liquidation is triggered when the debt reaches 85% of the collateral, which is $8,500: between the most you can borrow and the threshold that liquidates you there are $1,000.

The tricky part is less how much you borrow than where they stop you. Every collateral has a liquidation threshold above the maximum you can borrow, say 85%. If the price of eth falls and your debt ends up worth 85% of the collateral, the protocol sells the collateral to get its money back and keeps a penalty, usually between 5% and 15%. No phone call, no extension. A contract executes, and that’s it.

The trouble is that these sales all arrive together. When the market falls fast, thousands of positions touch the threshold at the same moment, the sold collateral lands on the market, the price falls further, and the fall trips the next threshold. It happened in the March 2020 crash, and again in every one of the sell-offs between 2022 and 2023.

How do you build leverage out of loans, and why does it break?

In a loop. You deposit eth, borrow stablecoins up to the limit, buy eth back with them, deposit that again, and start over. Each lap adds exposure without adding capital: $10,000 at the start becomes $7,500 at the first loan, $5,625 at the second, and the total exposure reaches $23,125, about 2.3 times what you put in.
yours1st lap2nd lapexposure
the laps of the leverage: $10,000 of yours, $7,500 at the first loan, $5,625 at the second, and together they make the $23,125 of exposure. source: the sum above.

Starting from $10,000 of eth, each lap lends 75% of what was just deposited: $7,500 on the first lap, $5,625 on the second. The final exposure is about $23,125, which is 2.3 times the starting capital, and with every lap the liquidation threshold comes closer.

While the price rises it’s the best thing in the world: if eth gains 10%, you gain around 30%. When it turns, the same multiplication runs backwards and a 10% fall takes 30% off you. Except the fall has a floor, and the floor is called liquidation. Every lap you did raised your LTV, so the threshold is closer than it was when you started.

It’s leverage under another name, with nobody to ask for an extension. The mechanism itself is neither good nor bad. It multiplies, and it multiplies what you don’t want too. People who use it well know exactly at what price they get liquidated and keep margin aside to stay clear of it. People who use it badly find out the day the market drops ten percent.

What changes between a transparent protocol and one that asks for trust?

Where the risk sits, more than how big it is. Celsius, BlockFi and FTX promised high yields and sold themselves as new finance, but they were old intermediaries, with the leverage hidden in the books and risk control that didn’t exist. When the first one went, the customers’ money was nowhere to be found.

The lesson that stuck is that audited code isn’t enough. An audit says an outside firm looked at the code and didn’t find certain errors, and that’s all it says. It doesn’t tell you whether the business model holds up, or who holds the keys. If the protocol is really a company promising a yield, the risk you’re running is the company’s.

four risks, four different places
riskwhere it startshow you notice
counterpartywhoever holds the money when it is already too late
bug in the contractthe code audits, and even they aren’t enough
manipulated oraclethe price the contract reads which oracle it uses, and for how long
bank runa till that doesn’t stretch how much liquidity is really available
the four risks that remain even after the code has been audited.

The risks that remain after an audit: counterparty risk, which starts with whoever holds the money and shows only when it is late; the bug in the contract, which lives in the code and is public; the manipulated oracle, which comes in through the price the contract reads; the bank run, which starts with a till that doesn’t stretch and shows in the available liquidity.

In the genuinely decentralized protocols, like Aave, Compound or Maker, the risk is still there. It’s a different kind, and at least you can look it in the face: a bug in the contract, a manipulated oracle reporting the wrong price, a pool that runs dry if everyone leaves at once. The code is public and everything happens onchain, so anyone who cares to can measure that risk.

Where does the yield they offer you come from?

From two places only, and they’re opposites. Either from the fees paid by the people using the protocol, or from the tokens the protocol prints and hands out. The first is money that already exists. The second is money that still has to come from whoever buys after you.
the users’ feesnew tokensthe yield they pay you
the two sources of a yield: the fees of the people who use the protocol, or the tokens the protocol prints.

A yield can come from the fees paid by people actually using the protocol, which is money that already exists and can be traced onchain, or from new tokens handed out as rewards, which hold up only while somebody is willing to buy them.

You can spot a yield of the first kind by three signs. It sits in a believable range, usually between 5% and 30%. You can follow it onchain back to whoever paid it. And it doesn’t need anyone to keep printing to stay up. GMX passes 30% of its trading fees to stakers. When volume falls the yield falls too, which is uncomfortable but also the sign that it’s real. The GLP pool earns from perpetuals fees and from the net of the traders’ wins and losses, so it pays well but loses when they win. Curve’s stablecoin pools pay little, and they pay every time.

You spot the second kind even faster: three-, four-, five-figure numbers, the yield paid in the protocol’s own token, capital that shows up only for the reward and leaves the next day, no real fee anywhere. Wonderland and the dozens of Olympus copies promised 80,000% a year. That was exactly the mechanism: print, hand out, the recipients sell, the price falls, and to hold the yield up you have to print more. Playing that game is a bet on getting out before everyone else, which has little to do with investing.

put bluntly
yield farming is the most efficient method ever invented for making people believe they are making money while they lose it

Put bluntly: yield farming is a way of making people believe they are earning while they are losing.

How many pieces are you stacking without noticing?

Composability is the best thing about onchain finance: every protocol fits with the others, and you build on top of them like Lego bricks. Every joint, though, adds a new way to break.
lidocontractaaveoracleloanliquidationcurveexitconvexcontractanother loanall of them
six protocols stacked on one pot of capital, and under each link the risk it adds.

The typical chain: eth deposited with Lido becomes stETH, used as collateral on Aave to borrow usdc, put into a Curve pool, whose token is staked on Convex and in turn used as collateral elsewhere. Every link adds its own risk, whether the contract, the oracle, the liquidity or a slipped peg, and the capital underneath is always the same.

Many people hold a chain like this today without ever having written it out. You deposit eth with Lido and get stETH. You use stETH as collateral on Aave and borrow usdc. You put the usdc into a Curve pool, stake the pool’s token on Convex to boost the reward, and maybe use that as collateral somewhere else too. Six protocols, five different contracts, one pot of capital.

At that point any one of four things can wipe you out, and none of them depends on you: a bug in any of the contracts, an oracle getting stETH’s price wrong or stETH slipping its peg to eth, a pool without enough liquidity to let you out when you need it, and any link in the chain getting drained. Before you ask what the chain pays, ask how many links it has.

What actually happened when Terra went?

May 2022 showed in practice what chain risk means. UST, Terra’s stablecoin, slipped its peg to the dollar, and everyone holding it ran for the exit at once.
the depegust loses its peg to the dollar and everyone holding it runs for the exit
shortly aftercurve’s 3pool goes out of balance and stops giving a reliable price
thenthe protocols that accepted ust as collateral are left with unrecoverable debts
at the same timewhoever deposited into anchor, the yield protocol on top of terra, loses the funds
weeks latercelsius and voyager, holding ust and luna for their customers, go under

The May 2022 contagion in order: UST loses its peg to the dollar and the run for the exit begins; Curve’s 3pool goes out of balance; the protocols that accepted UST as collateral are left with unrecoverable debts; whoever had deposited into Anchor loses the funds; the intermediaries holding UST and LUNA, Celsius and Voyager, go under in the following weeks.

From there the contagion followed the joints one by one. Curve’s 3pool, which held UST, went out of balance and stopped giving a reliable price. The lending protocols that accepted UST as collateral were left with debts nobody would repay. Anyone with money in Anchor, the yield protocol built on top of Terra, watched it vanish. And in the weeks that followed, the intermediaries holding UST and LUNA for their customers, like Celsius and Voyager, went under.

One point giving way spread tens of billions in losses, through protocols that had no bugs and companies that had done nothing illegal that day. That’s why the question “how many links does this chain have” is worth more than any yield on an interface.

Where are the opportunities that are left?

There are some, and they pay less than you’d like. The protocols with years of operation behind them, several audits and liquidity that stays put, like Aave, Compound and Maker, pay between 2% and 8%, with a risk that’s known. Curve sits between 3% and 10% on the main stablecoin pools. GMX and its GLP pool reach 15% to 30%, but that yield includes the net of the traders’ wins and losses, so some months it comes out negative.

There are three quiet strategies. Putting stablecoins on the biggest protocols pays 3% to 6% with no impermanent loss. Liquid staking, with stETH or rETH, pays the network’s yield, around 3 or 4%, and leaves you holding a receipt you can still trade. In exchange you take on contract risk and the risk of the validator being penalized. The third is delta neutral: you buy spot and sell the same amount on the perpetual, so the price no longer touches you and you collect the funding rate.

bought spotsold on the perpetualsum: zero
the delta neutral position: two legs, equal and opposite, and what’s left is the funding.

In a delta neutral position you buy an amount spot and sell the same amount on the perpetual: the two positions cancel out against the price, and what is left to collect is the funding rate paid between longs and shorts.

Delta neutral is also the best reminder of what this job really is. The two positions cancel out, so the yield comes from the work of keeping them balanced rather than from calling the direction, and that work has to be done every day.

What should you check before you put a dollar in?

Eight checks, in this order. Where the yield comes from: fees from real users, or printed tokens? If you can’t follow it onchain back to whoever paid it, it’s the second. How many audits it has, and from whom: at least two, by names you can verify, and above all check that the problems they found were actually fixed. How much capital is inside and how much it moves: below fifty million the liquidity is thin, and steady volume is the sign that somebody really uses it, rather than just farming the rewards.
the minimum list, before depositing
what you look atbelow this line, walk away
where the yield comes fromyou can’t follow it onchain
auditsfewer than two, or fixes never verified
capital insidebelow fifty million
volumeit only moves when there are rewards
time standingless than six months, no downturn come through
team and decisionsanonymous, with the keys in few hands
oraclebuilt in-house
exit testyou haven’t run it
the eight checks, with the line below which it is better to walk away.

The eight minimum checks before depositing: the source of the yield has to be followable onchain; at least two audits with the fixes verified; capital above fifty million with steady volume; at least six months of operation, better still with a downturn come through; a verifiable team and decision process; a standard oracle; a liquidation mechanism with brakes on the cascades; and the exit test at a hundred, a thousand and ten thousand times your own size.

Then: how long it has been around. Six months without an incident is the minimum, and having come through a long downturn is worth far more. Who’s behind it and how decisions get made: a named team helps, but anonymity can hold up too if the protocol is decentralized enough not to depend on them. Which oracle reads the prices, because that’s the attackers’ favorite way in. How liquidation works, if it’s a lending protocol, and whether anything slows a cascade of sales. And finally the simplest test of all, and the most skipped: try getting out. With a hundred thousand, with a million, with ten, and look at what it costs you in slippage before you deposit, not after.

The signals to walk away are just as practical: less than ten million of capital inside, a yield above 50% with no source that explains it, an anonymous team and code that was never audited, a large token unlock on the way, and no real downturn ever survived.

Why do most of the people who try lose?

For five reasons, and they’re always the same five. People chase the biggest number without asking where it comes from. They don’t check the protocol before depositing. They don’t do the subtraction between fees and impermanent loss. They take too much leverage and get liquidated on the first bad day. And they mistake for a serious protocol something that only stands up while new people keep arriving.

Onchain finance has come a long way: the big protocols have years of running behind them, security has become a serious trade, and the interfaces are no longer just for programmers. It’s still a place where not knowing costs you right away and costs you a lot, and where nobody calls to warn you.

put bluntly
scam, no. minefield, yes: ninety percent of the mines look like gold… and if you can’t tell the difference, you’re the exit liquidity

Put bluntly: decentralized finance is a minefield more than a scam, and most of the mines look like gold. Whoever can’t tell the two apart ends up as the buyer for whoever is selling.

What works is boring and fits in five lines. Learn the mechanisms, pool, loan and liquidation, before you use them. Start with the big protocols and a little capital. Do the real math: real yield minus impermanent loss minus liquidation risk. Don’t put everything in one place. And check your positions often, because a delta neutral that was balanced yesterday might not be today. It’s a job, dressed up as passive income.

last checkedAugust 18, 2026
understanding defi · step 2 of 3
Cascading liquidations next step · 4 min
the words in this piece · 31
amm
the program that holds two coins in its till and works the price out on its own with a formula, instead of matching buyers with sellers.
apr
the yearly return without counting the reinvestment of the interest.
audit
the examination of the code by an outside firm. it says they found no mistakes, not that there aren’t any.
book
the list of buy and sell orders waiting on a market. the thicker it is, the more liquid that market is.
collateral
what you leave as security for the loan. if its price falls too far, they sell it to close the debt.
concentrated liquidity
liquidity put only inside a chosen price band: it pays more while the price stays in there, and nothing the moment it leaves.
delta neutral
a position built so that price movements don’t touch it: what it gains on one side it loses on the other.
fee
what you pay to use a protocol. it can go to whoever supplies the service, to whoever holds the token, or to both.
funding
the periodic payment between whoever bets on a rise and whoever bets on a fall on a perpetual contract. it exists to keep that contract’s price tied to the spot market.
funding rate
the periodic payment between whoever is long and whoever is short, which keeps the perpetual’s price stuck to the spot price.
impermanent loss
how much you lose keeping your coins in a pool rather than still in the wallet, when the two prices move apart from each other.
lending
borrowing onchain: you leave one coin as collateral and have another lent to you, at a rate that rises and falls with demand.
liquid staking
you put the coin into staking and get back a receipt that stands for it and stays tradable.
liquidation
the forced sale of the collateral when the debt gets too big against the security behind it.
liquidity provider
whoever deposits their own capital in a protocol so that other people can trade, and collects a share of the fees in return. shortened to LP.
ltv
how much you have borrowed against what you left as collateral, as a percentage.
onchain
happening on the chain, and therefore verifiable by anybody.
oracle
the service that brings the market price inside the contract. if it gets the price wrong, everything sitting on top of it gets it wrong.
order book
the list of every offer to buy and to sell: the traditional way a price is made.
perpetual
the contract that follows a coin’s price without ever expiring: to stay open you pay or collect the funding.
pool
the common till the trades happen on: whoever puts their own coins into it takes a slice of the fees.
real yield
the yield that comes out of the fees paid by whoever uses the protocol, not out of printing new tokens.
sandwich attack
somebody sees your order before it is executed, buys ahead of you and sells again straight afterwards, leaving you a worse price.
short
the position that gains when the price falls. you open it by selling something you don’t own.
slippage
the difference between the price you expect and the price you actually get. it grows with the size of the order and with the thinness of the book.
spot
the market where the asset itself changes hands, delivered on the spot. as opposed to derivatives, where what trades is a contract.
stablecoin
a token built to be worth the same as a currency, usually the dollar. what changes is how it manages that: reserves at a bank, collateral onchain, hedges on derivatives.
staking
locking tokens up to keep a network or a protocol running, and receiving a yield in return. the tokens stay tied up for a set time.
token
the unit a protocol issues. it can serve to vote, to pay, to receive revenue, or to do nothing at all.
unlock
the moment when tokens locked up until that day become sellable.
yield
what a deployed capital earns, written as a yearly percentage.
guide · checked August 18, 2026all the guides