Yield Farming Internals
Yield farming is the practice of deploying capital across DeFi protocols to earn returns - from swap fees as a liquidity provider, to governance token rewards, to complex multi-protocol strategies. Understanding the math behind LP positions, impermanent loss, and compounding is essential for anyone putting capital to work in DeFi.
Yield Sources in DeFi
Impermanent Loss
Why providing liquidity can lose you money - interactive calculator showing IL vs price divergence
LP Math
How liquidity pool shares work, fee accrual, and the constant product formula xy=k visualized
Auto-Compounding
Manual harvesting vs auto-compounding vaults - Yearn, Beefy, and the math behind compound yield
Yearn Finance
How Yearn's auto-yield vaults work - strategy allocation across Curve/Aave/Compound, yToken mechanics, and fee structure
Yearn vs Manual
Is Yearn automation worth the fees? Side-by-side calculator comparing gas costs, compounding frequency, and net returns
How yield farming works in 90 seconds
Yield farming is a catch-all for routing capital through DeFi protocols to earn a return. The four primary cash-flow sources are swap fees from being a liquidity provider on an AMM, lending interest from supplying to a money market like Aave or Compound, staking rewards from delegating consensus stake through Lido or Rocket Pool, and protocol-token emissions distributed by governance to bootstrap a specific pool. A real position usually combines two or more - say, deposit USDC and ETH into a Uniswap V3 0.05% pool, stake the LP receipt in a third-party gauge, and harvest the gauge's emissions in addition to the swap fees.
The math at the LP layer is the constant-product invariant x y = k for full-range pools and a piecewise version of the same curve for concentrated-liquidity pools. Spot price inside the pool is y / x; trades that move price create impermanent loss for LPs because the pool rebalances toward the new ratio, leaving the LP with more of the loser and less of the winner relative to a hold-only baseline. The closed form is IL = 2 ?r / (1 + r) ? 1, where r is the new-to-old price ratio; a 2 move costs roughly 5.7% relative to holding, and a 5 move costs roughly 25.5%.
Auto-compounders sit on top of these primitives to remove operational friction. Yearn vaults, Beefy reactors, and Convex's Curve front-end all batch harvests across depositors, route capital between strategies when one starts paying more, and re-stake rewards continuously. The price is non-trivial: Yearn charges 2% management plus 20% performance, Beefy charges 4.5% performance, and Convex takes 16% on Curve/CVX strategies. The break-even against doing it manually is gas-driven - at $15 per harvest, a daily compound on a 20% APY position only beats Yearn once deposits cross roughly $109,500.
Key concepts
- Constant-product AMM (x y = k)
- The base AMM curve used by Uniswap V2, SushiSwap, and most full-range DEXes. The pool keeps the product of the two reserves constant on every trade, so the spot price y/x moves smoothly along the curve and slippage scales with trade size relative to depth. LP shares represent a constant fraction of the reserves; a depositor's claim grows in token terms as fees accrue, but the dollar value depends on where price ends up relative to entry - that gap is impermanent loss.
- Impermanent loss math
- For a 50/50 constant-product pool, IL = 2 ?r / (1 + r) ? 1 where r is the new-to-old price ratio. The function is symmetric, so a 1.25 and a 0.8 move produce the same loss; reference points are roughly ?0.6% at 1.25, ?5.7% at 2, and ?25.5% at 5. LPs only realize the loss on withdrawal, which is why fee APR vs IL has to be tracked over the actual holding period rather than at any single snapshot.
- Concentrated liquidity
- Uniswap V3-style ranges let an LP deploy capital inside a chosen price band, multiplying capital efficiency inside the range. Outside the range the position holds 100% of one asset and earns zero fees. IL inside the range is amplified relative to a full-range pool by roughly the capital-efficiency factor, so a 1.5 move on a tight range can cost several times what the same move would cost on a Uniswap V2 pool. Aerodrome Slipstream, PancakeSwap V3, and Orca Whirlpools all use the same construction.
- ve-token gauges and bribes
- Curve, Aerodrome, Velodrome, Balancer, and Pendle all run ve-locked governance: lock the protocol token to vote on weekly emissions to specific pools. Third parties pay bribes to ve-holders to direct those emissions toward their pool. From a yield farmer's perspective this means a pool's emissions APR is not a constant - it shifts each epoch with bribe flow and can collapse to near zero when bribes evaporate, which is why time-stable LPs prefer fee-driven yield over emissions-driven yield.
- Auto-compounder fee stack
- Yearn charges 2% per year management plus 20% performance on profits, so net APY ? Gross (1 ? 0.20) ? 2%. Beefy charges 4.5% performance only and is cheaper for fast-turnover pools. Convex takes 16% on Curve and CVX strategies. The break-even against manual compounding depends on gas and harvest cadence - at $15 per harvest, daily manual compounding only outperforms Yearn once deposits cross about $109,500, which is why auto-compounders dominate the small-and-mid-sized depositor segment.
- yToken / share-price accounting
- Vault tokens like yDAI keep a constant balance per depositor and increase the price-per-share over time as yield accrues. So 952 yDAI at a price-per-share of 1.05 is a claim on 1,000 DAI. This avoids the rebasing-token problems that break vault accounting elsewhere in DeFi and is the same accounting trick used by wstETH, sDAI, and most modern yield-bearing wrappers.
Why yield farming matters
As of April 2026, on-chain LP, lending, and auto-compounder positions collectively hold tens of billions of dollars across Ethereum L1 plus the major L2s and Solana. Concentrated-liquidity AMMs (Uniswap V3, Aerodrome Slipstream, PancakeSwap V3) dominate volume share; ve-aligned DEXes (Curve, Aerodrome, Pendle) dominate emission-driven TVL. The cash flows that make all of this possible - swap fees, lending spreads, staking rewards, ve-governed emissions - are the closest DeFi has to a real-economy revenue base, and the design tradeoffs between them shape almost every newer protocol's tokenomics.
The reason yield farming matters as a discipline rather than just a buzzword is that it forces an honest accounting of risk-adjusted return. A 50% APR pool that pays in an emissions token losing value at 80% per year nets negative; a 6% USDC vault on a battle-tested money market may dominate it on a Sharpe-adjusted basis. The specific risks - impermanent loss in concentrated ranges, bribe dilution in ve-models, depegs on the stablecoin leg of a "stable" pair, governance-token tail risk on emission-heavy pools, and contract risk that compounds with every additional vault layer - are concrete, measurable, and almost always more important than the headline APR shown on a dashboard.
Frequently asked questions
- How is impermanent loss actually computed for an xy=k pool?
- For a constant-product 50/50 pool the IL formula is IL = 2 ?r / (1 + r) ? 1, where r is the price ratio of the new price to the entry price. The function is symmetric, so a 1.25 move and a 0.8 move produce the same loss. Concrete reference points: 1.25 ? ?0.6% IL, 1.5 ? ?2.0%, 2 ? ?5.7%, 3 ? ?13.4%, 5 ? ?25.5%. IL is realized only at withdrawal; until then it is a paper loss measured against simply holding the two assets.
- How do LPs actually earn - fees, emissions, or both?
- Three streams stack on top of each other. Swap fees come from the 0.01-1% tier the pool charges per trade and accrue inside the LP token itself; emissions come from protocol governance tokens (UNI, CRV, AERO, BAL) distributed to LPs as a bootstrap incentive; and bribes come from third parties paying ve-token voters to direct emissions toward specific pools. Real APR is the sum of all three minus IL minus gas. Most farmed-yield numbers in the wild are emissions-heavy and ignore IL, which is why headline APRs frequently exceed realized returns.
- What does Yearn actually do that I cannot do manually?
- Yearn batches harvests across all depositors in a vault, rebalances between strategies (Curve 3pool, Aave, Compound, leveraged stablecoin loops) when one outperforms, and routes capital through whitelisted strategies vetted by the Yearn governance. The catch is fees: Yearn charges a flat 2% management fee per year and a 20% performance fee on profits. Net APY is roughly Gross (1 ? 0.20) ? 2%, so a 20% gross strategy nets about 14%. The break-even against manual compounding scales with gas - at $15 per harvest the gas-amortization break-even sits north of $100,000 in deposit.
- What is the difference between Yearn, Beefy, and Convex on fees?
- Yearn charges 2% management plus 20% performance - the original auto-compounder pricing. Beefy Finance charges a flat 4.5% performance fee with no management fee, which is materially cheaper for high-yield pools where principal turnover is fast. Convex sits in front of Curve specifically and takes a 16% platform fee on Curve and CVX strategies in exchange for vlCVX-aligned vote routing. The right choice is asset-specific: Beefy wins on volatile high-APY pairs, Yearn wins on long-tail strategies, Convex wins for anyone who actually wants Curve-vote exposure.
- Why does concentrated liquidity make IL worse?
- Uniswap V3-style concentrated liquidity lets an LP deploy capital inside a chosen price range instead of across the full curve. Inside the range, the LP receives roughly the same exposure as a leveraged xy=k position; the magnification factor scales with how tight the range is. Tight ranges earn far more swap fees per dollar deployed but also amplify IL by the same factor - a 1.5 move with a 4 capital-efficiency factor produces roughly 4 the IL of a full-range pool, and the position is fully out of range above and below the bounds, earning zero fees while still holding 100% of the wrong asset.
- What are the specific risks people undercount in 'yield farming is risky'?
- Five concrete risks dominate, and most generic warnings hide them. First, impermanent loss in concentrated LPs is amplified relative to full-range pools by 1/(1?L/U)^0.5 where L and U are the bounds. Second, bribe dilution in ve-models means a pool's emissions can collapse week-over-week if bribes evaporate. Third, depeg risk - a stablecoin pair pays great APY until one side breaks (USDC March 2023, UST May 2022). Fourth, governance-token tail risk: emissions paid in a token that loses 90% of its value erase a year of yield in a week. Fifth, contract risk: every additional protocol layer (vault on top of a strategy on top of an AMM) multiplies attack surface.
- How big is on-chain yield farming as of April 2026?
- As of April 2026, on-chain LP, lending, and auto-compounder positions collectively sit in the tens of billions of dollars across Ethereum L1, Arbitrum, Base, Optimism, BNB Chain, Solana, and a long tail of L2s. Concentrated-liquidity AMMs (Uniswap V3, PancakeSwap V3, Aerodrome Slipstream) dominate volume share, while ve-aligned DEXes (Curve, Aerodrome, Velodrome, Pendle) dominate emission-driven TVL. Auto-compounder TVL through Yearn, Beefy, and Convex remains material but has shifted toward higher-yield restaking and LRT vaults rather than the original Curve 3pool farming era.