Learn › Crypto

Where DeFi Yield Comes From: Liquidity Pools, Impermanent Loss, Staking, Lending

Crypto yield is never free. The x·y=k pool, the impermanent loss formula, the fees needed to break even, real staking yield, liquidation and smart-contract risk.

Advanced 10 min read 22 October 2026

What you will learn
  • In an x·y=k pool, any price move leaves you with less than simply holding. Price ×2 or ×0.5 costs 5.72%, price ×4 costs 20%
  • The fees you need just to match holding are ½(√r − 1)² of your deposit. Price ×2 needs 8.58%, price ×4 needs 50%
  • Concentrated liquidity amplifies fees and impermanent loss together. In our 80–125 range example, loss at the edge grows from 0.62% to 5.87%
  • A 5% staking reward on a coin whose supply grows 4% a year raises your real share by only about 0.96%
  • Every yield has a payer. If you can't say who, the money being paid out may be your own

Yield in crypto means the return you get from parking coins somewhere: a liquidity pool, a staking system or a lending platform. The number on screen looks like interest on a deposit, but the machinery behind it is very different. Every yield has a payer, and a cost that isn’t printed on the label. This article goes through each source one at a time, works out every number step by step, and ends with rules you can use to check a yield yourself. If you’re new to crypto markets, read Crypto vs Forex first.

Yield comes from five places

Source of yieldWho paysCost carried by whoever earns it
Trading fees in a poolPeople swapping coinsImpermanent loss, code risk
Loan interestBorrowersCollateral not covering the debt (bad debt), locked withdrawals when everything is lent out
Staking rewardsThe network minting new coins, plus transaction feesSupply inflation, lock-ups, slashing
Reward tokens (emissions)A project printing its own token to hand outThe reward token’s price falls as recipients sell
New depositors’ moneyWhoever arrives laterA Ponzi scheme, which collapses when new money stops

Sources 1 to 3 are income from real activity. Source 4 is a giveaway that lasts only as long as someone keeps buying the reward token. Source 5 is what Scam red flags describes: high, steady returns with no explainable source usually belong here.

If you don’t know where the yield comes from, you are the yield.

Traders also earn funding on perpetual contracts by holding the coin and shorting the perp at the same time (see Perpetual futures and funding). The payers are longs willing to pay for leverage, and funding can flip sign. This article focuses on the first three sources.

Liquidity pools: a market with no one quoting prices

A normal exchange matches buy orders with sell orders. Many decentralised exchanges (DEXs) use a liquidity pool instead: a pile of two coins deposited by ordinary users, called LPs (liquidity providers). Anyone who wants to swap trades against the pile, and LPs earn the fees in proportion to their share.

The most basic design is constant product. It has one rule: the number of coin A (x) times the number of coin B (y) must stay the same.

x · y = k

The pool’s price is y ÷ x. When someone buys A, x falls and y rises, so the pool’s price of A goes up on its own. When the outside price changes, arbitrageurs (traders who buy where it’s cheap and sell where it’s dear) trade against the pool until its price matches the outside one. The result is that the pool keeps selling the coin that is rising and buying the coin that is falling, all the way, and that difference goes to the arbitrageurs.

Worked example: the price doubles

Deposit 10,000 dollars half and half: 50 of coin A at 100 dollars, and 5,000 in a stablecoin (made-up numbers, fees ignored).

  1. k = 50 × 5,000 = 250,000
  2. A rises to 200. The pool needs y ÷ x = 200 and x · y = 250,000, which gives x = √(250,000 ÷ 200) = 35.355 coins and y = √(250,000 × 200) = 7,071.07
  3. LP value = 35.355 × 200 + 7,071.07 = 14,142.14
  4. Just holding (HODL): 50 × 200 + 5,000 = 15,000
  5. Difference = 14,142.14 ÷ 15,000 − 1 = −5.72%, or 857.86 dollars

That gap is called impermanent loss (IL). On the way up the pool sold 14.645 of coin A at an average price below 200.

The impermanent loss formula

Let r = current price ÷ price at deposit (of one coin measured in the other). For a 50/50 x·y=k pool:

IL = 2√r ÷ (1 + r) − 1

Check with the example, r = 2: 2 × 1.4142 ÷ 3 − 1 = −5.72%, a match. Every row in the table was computed in node for a 10,000-dollar deposit.

Price of A vs depositLP valueHold 50/50ILLP vs holding 10,000 in cash
×0.57,071.077,500.00−5.72%−29.29%
×1.2511,180.3411,250.00−0.62%+11.80%
×214,142.1415,000.00−5.72%+41.42%
×420,000.0025,000.00−20.00%+100.00%

Three things the table shows:

  • IL ignores direction. ×2 and ×0.5 cost the same. What matters is how far price travels, not whether it goes up or down.
  • IL grows faster than a straight line. ×1.25 costs only 0.62%, ×4 costs 20%.
  • An LP still carries full price risk. The last column compares with cash: halve the price and the LP position loses 29.29%. Providing liquidity is not a savings account.
×0.5 = −5.72% ×1.25 = −0.62% ×2 = −5.72% ×4 = −20% Doubling and halving cost the same IL vs holding 0% −10% −20% −30% ×0.2 ×0.5 ×1 ×2 ×4 Coin price vs price at deposit (log scale)
Impermanent loss of a 50/50 x·y=k pool, computed from 2√r ÷ (1 + r) − 1, fees not included. The horizontal axis is a log scale, so ×2 and ×0.5 sit the same distance from the middle.

How much in fees to break even

LPs hope fees will beat IL. The gap between holding and the LP position, as a share of the original deposit, simplifies to something very short:

Fees needed = ½ × (√r − 1)² of the deposit

  • ×1.25: ½ × (1.1180 − 1)² = 0.70% (69.66 out of 10,000)
  • ×0.5: ½ × (0.7071 − 1)² = 4.29% (428.93)
  • ×2: ½ × (1.4142 − 1)² = 8.58% (857.86, matching the example above)
  • ×4: ½ × (2 − 1)² = 50% (5,000)

This still leaves out gas (the blockchain transaction fee) for depositing and withdrawing. The key point: a pair that trends hard in one direction is an LP’s enemy. Fees come from trading volume, IL comes from the distance price travels. When price chops back and forth in a tight range, an LP collects fees with almost no IL. When it runs far one way, the opposite. Crypto’s fat-tailed moves (see Fat tails and black swans) mean runs of ×2 or ×4 are not rare.

Hold 50/50 (HODL) LP in x·y=k pool Hold 10,000 cash Unchanged price: all equal At ×4: LP is 5,000 below holding (−20%) 25,000 20,000 Value (dollars), 10,000 deposited 0 10,000 20,000 ×0 ×1 ×2 ×3 ×4 Price of coin A vs price at deposit
Value of a 10,000-dollar deposit three ways as the price of coin A changes. LP = 10,000 × √r, holding = 5,000 × (1 + r), fees not included. The gap between the blue and orange lines is the IL that fees have to make up.

Concentrated liquidity amplifies both sides

Many newer pools let an LP choose a price range to provide liquidity in. This is concentrated liquidity: the same money provides much deeper liquidity inside that range, in exchange for IL that is heavier by roughly the same factor. It works like putting leverage on an LP position.

A worked example using the range-pool formulas: deposit 10,000 dollars, starting price 100, range 80–125 (equally wide on both sides in ratio terms, ÷1.25 and ×1.25).

  • Liquidity per dollar is about 9.47 times deeper than full range. If your share of trading volume follows that depth, fees per dollar while price stays in range are also about 9.47 times higher.
  • At a price of 125, IL is −5.87%, versus only −0.62% for full range at the same price.
  • Above 125, the position is entirely stablecoin (10,590.17). It stops earning fees and gains nothing from further rises. At a price of 200, IL is −29.40%, versus −5.72% for full range.
  • Below 80, the position is entirely coin A (105.9 coins): you bought the falling coin all the way down.

A narrow range suits someone who watches it and moves it, and every move locks the IL in as a real loss, plus gas. The APY shown for narrow ranges is usually computed over a window when price stayed inside.

Staking yield and supply inflation: real yield

Staking means locking coins to help validate a proof-of-stake network. Most rewards come from newly minted coins, plus some fees. If rewards come from minting, people who don’t stake are diluted, and people who do stake are mostly just keeping their share.

A made-up example: 5% reward a year, total supply growing 4% a year.

  • A staker’s share changes by 1.05 ÷ 1.04 − 1 = +0.96%
  • A non-staker’s share changes by 1 ÷ 1.04 − 1 = −3.85%

So the 5% on screen is less than 1% of real share growth. The rest offsets the coin’s own inflation. What people call real yield is reward paid from fees users actually pay, not from minting. And all of this is counted in coins: if the coin’s price falls 30%, rewards paid in that coin don’t help much. Other staking risks are the unbonding period (when you can’t sell right away), slashing if a validator breaks the rules, and liquid staking tokens that can trade below their underlying value on a day when everyone rushes to sell.

Lending: interest comes from borrowers, and borrowers get liquidated

DeFi lending platforms let one person deposit coins to earn interest and another post collateral and borrow. Rates usually rise with the share of deposits that is borrowed (utilisation). Borrowers must post more collateral than they borrow, and the system uses a health factor to decide when to force-sell (liquidate).

Health factor = collateral value × liquidation threshold ÷ debt

Example: 10,000 dollars of collateral, 6,000 in stablecoins borrowed, liquidation threshold 80% (this varies by platform and by coin, so check each platform’s docs).

  1. Health factor = 10,000 × 0.8 ÷ 6,000 = 1.33
  2. Liquidation happens when the health factor drops below 1, when collateral is worth 6,000 ÷ 0.8 = 7,500
  3. A 25% fall in the collateral is enough. Borrow 7,000 instead and it takes only 12.5%

On liquidation, the system sells part of the collateral to whoever repays the debt, with a penalty that varies by platform. For depositors, the risk is collateral falling so fast it can’t be sold in time, leaving bad debt nobody repays, and, when almost everything is lent out, being unable to withdraw until borrowers repay. The idea of distance to a forced close is the same as in Leverage, margin and stop out.

Risks that aren’t in any formula: code, oracles, bridges

Everything above runs on smart contracts, code on a blockchain. If the code has a flaw, a whole pool can be emptied in a single transaction, and usually nobody can reverse it. Common routes:

  • Code bugs. An audit lowers the risk but doesn’t guarantee anything. Audited projects have been hacked many times.
  • Oracles, the price feeds a system uses to decide liquidations. If the price is manipulated on a thin market, the system can lend or liquidate at the wrong price.
  • Admin keys. Many projects have keys that can upgrade or pause the contracts. If those keys leak, or the team simply runs off with the money (a rug pull), it’s over.
  • Bridges, which move coins between chains, hold large amounts in one place. In 2022 several bridges were hacked, some for losses in the hundreds of millions of dollars. A “wrapped” coin is worth only what the bridge can still back.

These risks are rare and don’t show up as daily volatility, but when they hit, the loss is total. They stack on top of the exchange and stablecoin risks in Crypto risks beyond price. The only defence that really works is limiting how much sits in any one place.

Rules for checking a yield before you deposit

  1. Name the payer. Fees from traders, interest from borrowers, newly minted coins, or later arrivals’ money. If you can’t answer, don’t deposit.
  2. Split the yield into parts. How much is real fees, how much is reward tokens. Assume the reward token’s price may fall a lot.
  3. Work out IL before, not after. Ask whether this pair could move ×2 while you’re in, and whether fees would reach 8.58% of your deposit.
  4. Compare with the simpler alternative. An LP against just holding, staking against the coin’s inflation, not against zero.
  5. Size for code risk. Use money whose total loss wouldn’t affect your life, and spread it across places.
  6. Be wary of APY numbers. A short window scaled up to a year is not what you will get, and nobody can guarantee a return in DeFi.

Common mistakes

  • Treating a pool like a savings account. An LP still carries full price risk: halve the price and the position is down 29.29% before fees.
  • Watching fees and ignoring IL. You see fees every day. You see IL when you withdraw.
  • Picking a narrow range for the highest APY. A narrow range is leverage. Once price leaves it you hold only the weaker coin, and earn no fees.
  • Counting staking rewards as pure profit. It forgets the coin’s own inflation and its changing price.
  • Borrowing close to the limit. A health factor of 1.14 is liquidated by a 12.5% fall, which crypto can do in a day.
  • Treating an audit as a guarantee. An audit checks the code at one point in time. Code and settings can change afterwards.
Try it with your own numbers

Frequently asked questions

Does impermanent loss really go away?

It does if the price returns to the same ratio as when you deposited, which is why it is called impermanent. But withdraw while the price is away from that point and the loss becomes real at once, and nothing guarantees the price will come back.

Do stablecoin-to-stablecoin pools have no impermanent loss?

While both stay close to one dollar the loss is close to zero. But if one of them depegs, the pool sells the healthy coin and takes in the broken one, and liquidity providers end up holding mostly the coin that lost its peg. That is the main risk of these pools.

Does a high APY mean a pool is worth depositing in?

Not by itself. APY figures are usually extrapolated from a short recent window and often include reward tokens whose price can fall. Ask first who pays, what they pay with, and what risk you carry in exchange.

This is general education, not investment advice. Trading is risky and you may lose all of your capital.

Tools Chat on LINE