Advanced DeFi · 🕑 16 min read PRO

Yield Farming: Mechanics, Math, and Real Risks

A deep dive into how yield farming actually works at the protocol level liquidity pools, impermanent loss calculations, token emission schedules, and why the headline APY numbers are almost always misleading.

Beyond the Headline APY

A DeFi protocol advertises 400% APY. Before you deposit anything, you need to understand three things: what that APY is denominated in, how long it will last, and what risks you are accepting to earn it.

Most headline APYs combine trading fee yield (paid in pool tokens, relatively stable) with token emission rewards (paid in the protocol's governance token, highly volatile and subject to dilution). The 400% APY is often 5% in fees and 395% in tokens that may lose 90% of their value before you can exit.

Beyond the Headline APY

A DeFi protocol advertises 400% APY. Before you deposit anything, you need to understand three things: what that APY is denominated in, how long it will last, and what risks you are accepting to earn it.

Most headline APYs combine trading fee yield (paid in pool tokens, relatively stable) with token emission rewards (paid in the protocol's governance token, highly volatile and subject to dilution). The 400% APY is often 5% in fees and 395% in tokens that may lose 90% of their value before you can exit.

How AMM Pricing Works

The most common AMM formula is the constant product: x * y = k, where x and y are the quantities of the two tokens in a pool and k is a constant.

When you buy token Y with token X, you increase x and decrease y. The price adjusts automatically so the product remains constant. This means larger trades cause more price impact (slippage), and the pool is always in "balance" by definition though not necessarily at the market price.

Arbitrageurs keep AMM prices aligned with market prices by profiting from any discrepancy. Their arbitrage activity is what generates much of the trading fee revenue that LPs earn.

Impermanent Loss: The Math

If you deposit equal values of Token A and Token B, and Token A doubles in price relative to Token B, impermanent loss occurs. The formula:

IL = 2 * sqrt(price_ratio) / (1 + price_ratio) - 1

For a 2x price move in one asset: IL = 2 * sqrt(2) / (1 + 2) - 1 = approximately -5.7%

For a 5x price move: approximately -25.5% IL

For a 10x price move: approximately -42.5% IL

This loss is "impermanent" only in the sense that it reverses if prices return to the original ratio. If you withdraw while prices are diverged, the loss becomes permanent. You earn trading fees in return the question is whether fees outweigh IL for your specific pool.

Token Emission and Dilution

Governance token rewards work like this: the protocol allocates a fixed number of tokens per day to reward liquidity providers. If you provide 1% of the pool's liquidity, you earn 1% of the daily emissions.

Problem: as higher APY attracts more capital, your share of emissions shrinks. The APY decays rapidly after a protocol launches. A pool advertising 1000% APY on day one may be offering 40% APY two weeks later when the capital has flooded in and the token itself may have dropped 70%.

Risk Stack

A typical yield farming position carries layered risks simultaneously: smart contract risk in the AMM protocol, smart contract risk in any aggregator you use, liquidation risk if borrowing, governance token price risk, stablecoin depeg risk if using stables, and bridge risk if operating cross-chain. Each layer is independent any one can fail.

Key Takeaways

  • Decompose APY into fee yield vs token emission yield before trusting it
  • AMM pricing follows x*y=k larger trades cause more slippage
  • Impermanent loss grows significantly with large price divergences
  • Token emission APYs compress rapidly as capital enters the pool
  • Count every risk layer independently they do not cancel each other out
🔒
This is a Pro Lesson
Upgrade to Pro to access all advanced lessons, the full PLR library, and new content added monthly.
All advanced lessons unlocked
PLR Library — crypto books, audio series & educational guides
New lessons and resources added monthly
Quiz score tracking & progress
10% discount in the shop
$7/month
Cancel anytime — no contracts
Go Pro →
← Back to all lessons
Scroll to Top