How onchain liquidity works, and where the money is lost
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.
How does a pool make a price with no buyers and sellers?
When somebody buys eth, the eth in the till goes down and the usdc goes up. To hold the product still, the price the pool applies moves on its own: the bigger the order, the worse the price gets while the order fills. There is nobody on the other side, there is no order book to maintain, there is no bid to wait for — there is a curve, and there is you.
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.
The advantages are the ones that made the AMMs: you swap at any moment, with no counterparty and no waiting. The costs arrive right after, and there are three. Slippage on large orders, which is the price moving while you buy. The sandwich attack, which is somebody seeing your order before it fills, buying in front of you and selling behind. And impermanent loss, which affects not whoever swaps but whoever puts the money into the pool — and is the biggest of the three.
Why can providing liquidity pay less than sitting still?
The clearest example is the classic one. You deposit 1 eth when it is worth $2,000, plus 2,000 usdc. $4,000 in all. If eth doubles to $4,000, whoever held the coins still ends up with $6,000; you, in the pool, have $5,657, because the arbitrage along the way left you 0.707 eth instead of one. $343 missing, 5.7%.
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, whoever held still has $3,000 and you have $2,828: $172 missing, 5.7% again. The formula is symmetrical, and that is the most important thing to understand here. The direction doesn’t count. What counts is how far the two prices move apart. The fees you collect are there to cover that distance — if they don’t, you worked for the pool.
When does the loss stop being impermanent?
In practice prices almost never come back to where they started, and in any case you have to stay in the pool long enough for the fees to cover the hole — while the volatility, meanwhile, keeps widening it. The further the two prices diverge, the worse the sum gets, and it gets worse fast: a doubling costs 5.7%, a tripling 13.4%, a five-fold move 25.5%.
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 sum to do before depositing is always the same one, and it is a subtraction: what the fees pay minus what the impermanent loss costs. If a pool pays 30% apr in fees and the divergence of the prices costs you 40%, you are losing money while looking at a green number. Most liquidity providers look at only the first of the two numbers, because that is the one written large in the interface.
What actually reduces impermanent loss?
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 putting together coins that don’t diverge. Two stablecoins pegged to the same dollar — usdc, usdt, dai — almost never move apart, and the impermanent loss stays near zero. The fees are lower, but they are fees you keep. The second is putting together coins that move together: stETH and eth, wBTC and bitcoin. They aren’t the same asset, but they go the same way, and the distance that opens between them is small.
The third is concentrated liquidity, the one Uniswap introduced in version three. Instead of spreading the money across every possible price, you put it inside a band only. The same capital works much harder while the price stays in there, and stops working entirely the moment it leaves — outside the band you collect no more fees and you are left holding only the coin that lost. The fourth is having the impermanent loss made up to you with tokens the protocol issues. That works while the token is worth something: if it falls while you accumulate it, you have traded a certain loss for a bigger one.
What happens when you borrow against what you hold?
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 delicate point isn’t how much you take, it is where they stop you. Every collateral has a liquidation threshold higher than the maximum you can borrow — say 85%. If the price of eth falls and your debt comes to be worth 85% of the collateral, the protocol sells the collateral to get its money back, and keeps a penalty usually between 5% and 15%. There is no phone call and there is no extension. There is a contract that executes.
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 it happened again in every one of the deflations between 2022 and 2023.
How do you build leverage out of loans, and why does it break?
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 is the finest thing in the world: if eth gains 10%, you gain around 30%. When it turns, the same multiplication runs backwards — a 10% fall takes 30% off you — and unlike the gain, the fall has a floor called liquidation. Every lap you did raised your LTV, so the threshold is closer than it was when you started.
It is leverage, under another name and with nobody to ask for an extension. The mechanism is neither good nor bad. It is a multiplication, and it multiplies what you don’t want as well. Whoever uses it well knows exactly at what price they get liquidated and keeps the margin aside to stay clear of it; whoever uses it badly finds out on the day the market falls ten percent.
What changes between a transparent protocol and one that asks for trust?
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. It doesn’t say the business model holds, and it says nothing about who holds the keys. If the protocol is in fact a company promising a yield, the risk you are running is the company’s.
four risks, four different placesThe 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 — Aave, Compound, Maker — the risk still exists but is of another kind, and at least you can look at it: a bug in the contract, a manipulated oracle reporting the wrong price, a till that doesn’t stretch if everyone leaves at once. The code is public and the execution happens onchain, so the risk can be measured by anyone willing to measure it.
Where does the yield they offer you come from?
A yield can come from the fees paid by people actually using the protocol — money that already exists and can be traced onchain — or from issuing new tokens handed out as rewards, which holds up only while somebody is willing to buy them.
A yield of the first kind shows three signs: it sits in a believable range, usually between 5% and 30%; it can be followed onchain back to whoever paid it; and it doesn’t need the printing to go on in order to stand up. GMX hands its stakers 30% of the trading fees, and when the volume falls the yield falls too — that is uncomfortable, and it is the sign that it is real. The GLP pool earns from the perpetuals’ fees and from the balance between the wins and losses of the people trading in it, so it pays well but loses when they win. Curve’s stablecoin pools pay little and pay always.
The second kind shows itself even faster. Three-, four-, five-figure numbers; the yield paid in the protocol’s own token; capital that arrives only for the reward and leaves the next day; no real fee anywhere in it. Wonderland and the dozens of Olympus copies promised 80,000% a year, and the mechanism was exactly that: you print, you hand out, whoever receives sells, the price falls, and to hold the yield up you have to print more. Playing that isn’t investing. It is betting on getting out before everyone else.
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?
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 — contract, oracle, liquidity, a slipped peg — and the capital underneath is always the same.
A chain many people hold in their portfolio today without ever having written it out in full goes like this: you deposit eth with Lido and receive stETH; you use stETH as collateral on Aave; you borrow usdc; you put the usdc into a Curve pool; you stake the pool’s token on Convex to raise the reward; and maybe you use that as collateral somewhere else too. Six protocols, five different contracts, one single pot of capital.
At that point four things are enough to lose everything, and not one of the four 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 line being drained. The question to ask isn’t what the chain pays. It’s how many links it has.
What actually happened when Terra went?
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 follows the joints exactly. Curve’s 3pool, which held UST, goes out of balance and stops giving a reliable price. The lending protocols that accepted UST as collateral are left with debts nobody will repay. Whoever had put money into Anchor, the yield protocol sitting on top of Terra, watches it disappear. And finally the intermediaries holding UST and LUNA on their customers’ behalf — Celsius, Voyager — go under in the following weeks.
One single point giving way propagated tens of billions in losses, through protocols that had no bugs and companies that had done nothing illegal that day. It is why the question “how many links does this chain have” is worth more than any yield written in an interface.
Where are the opportunities that are left?
The quiet strategies are three. Putting stablecoins on the biggest protocols pays 3% to 6% and has no impermanent loss. Liquid staking — stETH, rETH — pays the network’s yield, around 3–4%, and leaves you holding a receipt that stays tradable; in exchange you take on the 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.
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 about this trade. The two positions cancel out, so the yield doesn’t come from having guessed the direction. It comes from the work of keeping them in balance, and that work has to be done every day.
What to look at before you put a euro in?
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 standing — six months without an incident is the minimum, having come through a long downturn is worth far more. Who is behind it and how decisions get made: a team with names helps, but anonymity can hold too if the protocol is decentralized enough not to depend on them. Which oracle reads the prices, because that is the favorite way in for attacks. How the liquidation works, if it is a lending protocol, and whether it has anything to brake the cascade of sales. And finally the simplest test of all and the most skipped: try leaving. 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 explainable source, an anonymous team and code that was never audited, a large token unlock coming, and no real downturn ever come through.
Why do most of the people who try lose?
Onchain finance has improved a great deal: the big protocols have years of running behind them, security is a serious trade, the interfaces are no longer only for programmers. It remains, though, a place where not knowing costs you immediately and costs you dearly, and where nobody calls to warn you.
Put bluntly: decentralized finance isn’t a scam, but it is a minefield where most of the mines look like gold — and 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, liquidation — before using them; start with the big protocols and little capital; do the real sums, which is real yield minus impermanent loss minus liquidation risk; don’t put everything in one place; and look at the positions often, because the delta neutral that was in balance yesterday isn’t today. It isn’t passive income. It’s a job, dressed up as passive income.
the words in this piece · 30
- 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.
- 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.