Math and economics
This page derives the core equations of YieldBasis from first principles. It shows how continuous compounding leverage converts a concave liquidity provider (LP) payoff into linear exposure, how LEVAMM prices and rebalances collateral, when trading fees outpace rebalancing drag, and how LT and YB distribute fees and emissions.
Notation
| Symbol | Meaning |
|---|---|
| External spot price of the volatile asset (such as BTC or ETH) in USD | |
Oracle price of one Curve LP token in USD (CryptopoolLPOracle.price()) | |
USD value of Curve LP collateral held by LEVAMM | |
Outstanding crvUSD debt in LEVAMM | |
| Net USD equity of the leveraged position () | |
| Compounding leverage factor (fixed to in YieldBasis) | |
Anchor term and constant-product invariant of LEVAMM at oracle price | |
Flash-loan amount (crvUSD) borrowed by VirtualPool | |
Unlevered Curve pool fee APR and reserved profit fraction (reserved_profit_fraction()) | |
Effective crvUSD borrow APR and refueling offset APR | |
| Rebalancing cost APR paid to arbitrageurs before refueling | |
Active admin-fee share and minimum admin fee (Factory.min_admin_fee()) | |
Staked yb-LP supply in the gauge and total yb-LP supply | |
Staked bucket value (staked) and watermark (ideal_staked) |
Constant-product AMM versus leveraged linear
Why a standard LP scales as
A constant-product AMM enforces , where is the USD reserve and is the volatile-asset reserve. Deposit equal USD value at with and , so . After the external price moves to , arbitrage aligns , giving:
Ignoring trading fees, the USD value of the LP position is:
Normalized by the initial $2 deposit, LP value per initial dollar scales as . Holding the initial assets instead yields , producing a relative shortfall whenever :
For example, if BTC doubles from $100,000 to $200,000 (), a $200,000 constant-product LP grows to $282,843, while holding grows to $300,000 (a 5.72% shortfall).
Why passive AMMs cannot avoid concavity—and how IL differs from LVR
A passive, oracle-free Constant Function Market Maker (CFMM) with reachable reserve set never initiates trades; external arbitrageurs minimize the pool's mark-to-market value at external price :
Because is the pointwise infimum of affine functions, it is necessarily concave () with slope (Angeris, Evans, Chitra 2021; Angeris, Diamandis, Boyd 2023). Concavity is required for a stable interior price: if , the pool never trades; if , any price move lets arbitrageurs drain 100% of one reserve. Consequently, no passive, unleveraged, oracle-free AMM can simultaneously provide stable liquidity and match holding () before fees.
This concavity creates two distinct effects that are often conflated:
- Static divergence loss (Impermanent Loss, IL): A path-independent gap comparing against holding initial reserves at endpoints . The moment arbitrageurs move the pool from to , IL is immediately present on a mark-to-market basis even if zero further trades occur. If returns to , endpoint IL closes to zero.
- Loss-Versus-Rebalancing (LVR): A strictly path-dependent adverse-selection cost comparing the passive pool against a frictionless strategy that holds the same inventory but trades at external market prices rather than on a stale curve (Milionis, Moallemi, Roughgarden, Zhang 2022). Under geometric Brownian motion with volatility , instantaneous LVR is (equal to for a fee-free constant-product pool). LVR accumulates on every stale-price arbitrage swap and stays strictly positive even if price returns to .
YieldBasis addresses these two costs at separate layers: continuous compounding leverage reshapes the LP's static payoff curve from back to linear (conditional on rebalancing keeping up with market moves), while Curve Cryptoswap's concentrated liquidity and optional oracle-backed dynamic fees (YBOraclizedPolicy) work to out-earn and recapture LVR on the underlying pool.
In derivatives terms (Clark 2020/2021; Lambert), a passive AMM LP is effectively short gamma (short volatility): its payoff replicates a portfolio of short options whose streaming premia are swap fees. Continuous compounding leverage cancels that short-gamma curvature back to linear spot exposure, trading short-gamma convexity for releveraging volatility decay. Similarly, Cartea, Drissi, and Monga (2023/2024) formalize this continuous adverse-selection and convexity drag as Predictable Loss (PL)—a model-free baseline that concentrated liquidity and dynamic fee sizing must out-earn.
How compounding leverage produces linear exposure
To track linear exposure, YieldBasis maintains crvUSD debt at a constant fraction of LP collateral value :
For an infinitesimal collateral move before debt adjusts, is fixed, so :
Integrating both sides yields , or the compounding-leverage power law:
Because Curve Cryptoswap LP value scales approximately as , substituting gives:
Setting gives : the leveraged position keeps full price exposure to BTC or ETH, up and down, while earning Curve pool trading fees on notional liquidity. At , debt equals 50% of collateral value—matching the crvUSD half of a balanced Curve LP position so unwinding the LP repays the debt cleanly.
LEVAMM invariant, safe bounds, and flash-loan sizing
Each market's LEVAMM (AMM.vy) holds Curve LP tokens against crvUSD debt and reads from CryptopoolLPOracle.price().
Invariant and anchor term
At equilibrium for oracle price , ideal debt and ideal collateral satisfy:
Defining the virtual stablecoin reserve , LEVAMM enforces the constant-product invariant:
Requiring the marginal price at to equal gives , which implies:
Equating to the live product yields a quadratic in . The @internal helper get_x0 in AMM.vy (not an external getter) takes the larger root:
In AMM.vy, LEV_RATIO stores scaled by 1e18 (equal to at ). The sandwich-resistant USD equity of the vault at (AMM.value_oracle()) is:
Safe debt bounds
When safe_limits is True, the @internal helper get_x0 in AMM.vy enforces a debt-to-collateral band around 50%:
MIN_SAFE_DEBT: of collateral value ( at ).MAX_SAFE_DEBT: of collateral value ( at ).
At , the quadratic discriminant vanishes at ; MAX_SAFE_DEBT leaves a buffer below that solvability boundary. Deposits revert with "Unsafe min" or "Unsafe max" outside this band. AMM.exchange() relaxes the check only when a trade moves coll_value / debt strictly closer to without crossing it. Withdrawals bypass the band because they remove collateral and debt proportionally.
VirtualPool flash-loan sizing ()
Arbitrageurs rebalance LEVAMM atomically through VirtualPool, which flash-borrows crvUSD to add or remove Curve liquidity in exact balance:
- Asset
crvUSD(i == 1, debt too low): , matching the Curve pool's reserve ratio. crvUSDasset (i == 0, debt too high): WithLEVAMMfee , arbitrageur input (discounted byROUNDING_DISCOUNT = 1e-8), Curve reserves , LP supply , and ,VirtualPoolsolves:
Rebalancing cost versus trading fee profitability
Because deploys twice the notional liquidity into Curve, gross pool fee APR scales linearly with . Subtracting borrow interest and rebalancing drag gives the net simple APR:
Why concentrated liquidity is required
Reshaping a concave curve into linear exposure does not make convexity free. Maintaining constant leverage requires borrowing more crvUSD to add LP collateral as price rises and repaying crvUSD by removing LP collateral as price falls. In choppy, mean-reverting markets, this convex rebalancing rule bleeds execution friction—the onchain equivalent of leveraged-ETF volatility decay—quantified here as . Linear exposure is also conditional on continuous arbitrage: during extreme gas spikes or crvUSD peg dislocations, leverage can temporarily drift away from .
Empirical simulations from the YieldBasis whitepaper show that rebalancing drag is roughly twice the fee APR of an optimized unlevered constant-product pool ():
On a standard pool, , leaving no margin to pay borrow costs or yield. YieldBasis achieves positive net return by pairing LEVAMM with Curve Cryptoswap, where concentrated liquidity generates a higher fee APR per unit of capital.
Inside Cryptoswap, the pool protects a fraction of fee profit (reserved_profit_fraction()) for LPs and spends the remainder on price_scale recentering. Under frequent recentering (with zero pool admin fee), realized pool fee yield is approximately:
plus LEVAMM's own swap fees (AMM.fee()). Under continuous compounding, .
Measuring realized LP profitability (three-surface markout PnL): Headline fee APR hides adverse selection. Empirical market-microstructure studies evaluate LP profitability using trade-level markout PnL ( across post-trade horizons ). In YieldBasis, an accurate markout attribution must separate three distinct execution surfaces—direct swaps on the underlying Curve Cryptoswap pool, atomic flash-routed rebalances through VirtualPool, and direct collateral-debt swaps against LEVAMM (AMM.vy)—without double-counting swap fees already embedded in execution prices.
Interest recycling (refueling loop)
Borrow interest accrued on LEVAMM's pooled crvUSD debt does not leave the market. Calling LT.distribute_borrower_fees() collects accrued borrow interest and donates 100% of it into the market's Curve Cryptoswap pool (add_liquidity(..., donation=True)).
Refueling loop: borrower interest recycles into the Curve pool's donation buffer to subsidize rebalancing.
A donation mints no LP shares; instead, it releases gradually over the pool's donation window to fund price_scale recentering alongside the rebalance budget. Including refueling alongside borrow interest gives:
In steady state (), this reduces to , so profitability holds whenever . When net rebalancing costs exceed trading fees, Fundamental Value (LT.pricePerShare()) declines (PPS drag).
Admin-fee curve and staked accounting
LT._calculate_values() splits eligible positive value gains between unstaked yb-LP holders and protocol admin fees using a square-root function of the staking ratio :
where is Factory.min_admin_fee().
- At , (unstaked LPs keep ).
- As , , while fewer unstaked shares split the remaining pool, raising yield per unstaked share and pulling the market toward equilibrium.
Accounting below the watermark
Let be the period value change, be the staked bucket value, be its watermark (ideal_staked), and be the watermark shortfall.
While the gauge holds at least 0.01 yb-LP (MIN_STAKED_FOR_FEES = 10**16 base units):
- Below the watermark ( and ):
LTwaives the admin fee on gains until the staked side's pro rata share closes , charging only on the excess: - At the watermark ( and ): and .
- Loss (): No admin fee (); losses split pro rata between staked and unstaked buckets.
(Below 0.01 yb-LP staked, LT applies symmetrically to both gains and losses.)
On gains, the staked bucket receives —zero when at the watermark—and unstaked holders receive .
Negative rebase of staked shares
Because unstaked shares retain post-watermark fee growth while staked shares do not, LT burns shares from the gauge contract so every yb-LP share keeps the same underlying value:
where and . To prevent divergence as , LT clamps using SQRT_MIN_UNSTAKED_FRACTION = 10**14 ():
YB emission decay curve
YB.emit() mints continuously from the 300,000,000 YB emission reserve using the immutable rate constant YB.max_mint_rate() (, a 4-year e-folding time):
GaugeController computes rate_factor from raw veYB gauge weights and each market's staking ratio:
When staking drops across voted gauges, rate_factor falls and stretches the reserve's decay horizon; when all voted gauges are 100% staked, rate_factor = 1 and emissions run at max_mint_rate.
Related
- How YieldBasis works: conceptual overview of compounding leverage.
- Fees and policies: fee streams, admin-fee chart, and pool policies.
- Oracles and MEV: LP oracle pricing, pool policies, and arbitrage mechanics.
- Tokenomics: YB allocations, vesting, and emission charts.
- Dev: Core vault and AMM: exact contract functions and state variables.