Skip to main content

Math primer

A constant-product liquidity provider (LP) position grows with the square root of the price. Compounding leverage of 2× turns it into a position that grows with the price. The equations below show why. The other economics pages cite them by equation number.

Each equation number starts with its section number, and other pages cite sections the same way:

  • §1: constant-product LP value, from the invariant x⋅y=kx \cdot y = k of Uniswap v2, and impermanent loss.
  • §2: compounding leverage.
  • §3: LEVAMM, the leveraged automated market maker (AMM), and the VirtualPool.
  • §4: net annual percentage rate (APR) and cost terms.
  • §5: admin-fee curve and staked accounting.

The derivations use ⋅\sqrt{\cdot}, exponents, and single-variable derivatives. The integration step in §2 uses ∫dln⁡V=ln⁡V+C\int d\ln V = \ln V + C.

The worked numbers use the canonical position from How YieldBasis works: 1 cbBTC deposited at a BTC price of $100,000. The YB whitepaper has the full derivations, with more algebraic steps and edge cases.

For short definitions of terms, read the Glossary. For the symbols in the equations, the notation table is authoritative.

Notation​

The table defines the main symbols. Some symbols, such as xx and yy, have a different meaning in different sections, and the table gives each meaning:

SymbolMeaning
ppBTC spot price in USD
pop_oOracle price of one Curve LP token, in USD, used by the LEVAMM (CryptopoolLPOracle.price())
VcV_cValue of collateral (Curve LP tokens)
V∗V_*Value of the leveraged position (after borrowing)
ddOutstanding crvUSD debt
LLCompounding leverage factor (fixed to 2 in YieldBasis)
xx§1: USD reserve of a constant-product pool. §3, Eq (3.2): x0(po)−dx_0(p_o) - d in the LEVAMM invariant. §3, flash-loan sizing: the crvUSD that the arbitrageur provides for the swap
yy§1: BTC reserve of a constant-product pool. §3: LP token amount held by the LEVAMM
y~\tilde{y}, d~\tilde{d}Ideal LP amount and ideal debt of the LEVAMM at the oracle price, Eq (3.1)
x0(po)x_0(p_o)Anchor term in the LEVAMM pricing formula
I(po)I(p_o)Invariant constant of the LEVAMM for a fixed oracle price
ϕ\phiFlash-loan size (crvUSD) solved via a quadratic
faf_aAdmin-fee fraction: the share of a value gain that LT, the market's vault contract, takes as admin fees
fmin⁡f_{\min}Minimum admin fee when nobody stakes
s,Ts, TStaked and total supply of yb-LP shares
vs,vs∗v_s, v_s^*Current and ideal (watermark) value of the staked bucket
rpoolr_{\text{pool}}Fee rate (APR) earned by the underlying Curve pool (unlevered)
rborrowr_{\text{borrow}}Borrow rate (APR) on the crvUSD collateralized debt position (CDP) line
rreleverager_{\text{releverage}}Rebalancing cost as an effective rate (APR): the cost of keeping leverage constant, before refueling
rrefuelr_{\text{refuel}}Refueling offset to rreleverager_{\text{releverage}}: the donation of recycled borrower interest
ρ\rhoReserved profit fraction: the share of its fee profit that the Cryptoswap pool protects for LPs (reserved_profit_fraction())

Constant-product LP value​

If BTC doubles from $100,000 to $200,000, a constant-product LP position that starts at $200,000 grows to $282,843. Holding the same assets grows to $300,000. The LP trails the hold by 5.72%, from Eq (1.6) and (1.9) at p=2p = 2. This section derives that shortfall.

Classic AMMs, for example Uniswap v2, enforce

x⋅y=k(1.1)x \cdot y = k \tag{1.1}

where xx is the USD side and yy is the BTC side. Let the external BTC price be pp (USD per BTC).

Normalized start​

Suppose that an LP deposits equal USD value at p0=1p_0 = 1:

  • x0=1x_0 = 1 USD
  • y0=1y_0 = 1 BTC (worth $1 at p0p_0)

So

k=x0⋅y0=1.(1.2)k = x_0 \cdot y_0 = 1. \tag{1.2}

Reserves after a price move​

Arbitrage pushes the AMM price to pp. In a constant-product AMM,

p=xy.(1.3)p = \frac{x}{y}. \tag{1.3}

Combine (1.1) and (1.3):

x=kp,y=kp.(1.4)x = \sqrt{k p}, \qquad y = \sqrt{\frac{k}{p}}. \tag{1.4}

With k=1k = 1:

x=p,y=1p.(1.5)x = \sqrt{p}, \qquad y = \frac{1}{\sqrt{p}}. \tag{1.5}

LP value proportional to √p​

Ignoring fees, LP USD value is

VLP(p)=x+p y=p+p⋅1p=2p.(1.6)V_{\text{LP}}(p) = x + p\,y = \sqrt{p} + p \cdot \frac{1}{\sqrt{p}} = 2\sqrt{p}. \tag{1.6}

The initial deposit totals $2, so the per-initial-dollar scaling is

VLP,norm(p)=p(1.7)\boxed{V_{\text{LP,norm}}(p) = \sqrt{p}} \tag{1.7}

Impermanent loss​

If the LP holds the assets and does not provide liquidity:

Vhold(p)=p+1.(1.8)V_{\text{hold}}(p) = p + 1. \tag{1.8}

Impermanent loss (IL), the underperformance relative to a hold, is

IL(p)=VLP(p)Vhold(p)−1=2p1+p−1.(1.9)\text{IL}(p) = \frac{V_{\text{LP}}(p)}{V_{\text{hold}}(p)} - 1 = \frac{2\sqrt{p}}{1+p} - 1. \tag{1.9}

Since 2p<1+p2\sqrt{p} < 1+p for any p≠1p \neq 1, IL(p)<0\text{IL}(p) < 0: the LP underperforms a hold whenever price drifts.

Takeaway. Constant-product LP value ∝p\propto \sqrt{p}. More complex AMM formulas also have IL. The source is a value function that grows more slowly than price. To match a linear hold, a position needs a value that is linear in price. A yb-LP share gives such exposure: it keeps full price exposure to BTC or ETH, up and down.


Compounding leverage​

On the canonical position, the same doubling of BTC takes the yb-LP position from $100,000 to $200,000, before costs. The leverage turns the p\sqrt{p} curve of §1 into a straight line, Eq (2.7).

YieldBasis borrows against the LP collateral to keep a constant compounding leverage of LL.

Compounding leverage identity​

By construction, the protocol keeps debt at a fixed fraction of collateral:

d=Vc(1−1L).(2.1)d = V_c \left(1 - \frac{1}{L}\right). \tag{2.1}

So the net position value is

V∗=Vc−d=VcL.(2.2)V_* = V_c - d = \frac{V_c}{L}. \tag{2.2}

Consider a small change in collateral value dVcdV_c. After the protocol re-leverages to restore the ratio, LL amplifies the relative change of V∗V_*:

δV∗V∗=L δVcVc.(2.3)\frac{\delta V_*}{V_*} = L \, \frac{\delta V_c}{V_c}. \tag{2.3}

Integrate both sides:

∫δV∗V∗=L∫δVcVc  ⟹  ln⁡V∗=Lln⁡Vc+const.(2.4)\int \frac{\delta V_*}{V_*} = L \int \frac{\delta V_c}{V_c} \;\Longrightarrow\; \ln V_* = L \ln V_c + \text{const}. \tag{2.4}

Exponentiate:

V∗∝Vc L(2.5)\boxed{V_* \propto V_c^{\,L}} \tag{2.5}
Why is the relative change amplified?

Growth of the price of collateral.

If the collateral grows in price, the value V∗V_* changes as follows (dd stays constant at this step):

V∗+δV∗=Vc−d+δVc−δd=(Vc−d)+δVc=V∗+δVc=V∗+yδpV_* + \delta V_* = V_c - d + \delta V_c - \delta d = (V_c - d) + \delta V_c = V_* + \delta V_c = V_* + y\delta p

δV∗V∗=yδpypL=Lδpp=LδVcVc\frac{\delta V_*}{V_*} = \frac{y \delta p}{\frac{yp}{L}} = L\frac{\delta p}{p} = L\frac{\delta V_c}{V_c}

Adjustment of the debt value and of the collateral amount.

By definition:

d=Vc(1−1L)d = V_c\left(1-\frac{1}{L}\right)

Then:

V∗+δV∗=Vc−d+δVc−δd=(Vc+δVc)−d−(1−1L)δVc=V∗+1LδVc=V∗+1LpδyV_*+\delta V_* = V_c - d +\delta V_c - \delta d = (V_c + \delta V_c)-d-\left(1-\frac{1}{L}\right)\delta V_c = V_*+\frac{1}{L}\delta V_c = V_*+\frac{1}{L}p\delta y

Whence it follows that

δV∗V∗=pδyLpyL=δyy=δVcVc\frac{\delta V_*}{V_*} = \frac{\frac{p\delta y}{L}}{\frac{py}{L}} = \frac{\delta y}{y} = \frac{\delta V_c}{V_c}

In this step, the value of the leveraged position tracks the collateral value linearly. The total scaling factor equals the scaling factor from the previous step. The General Idea section of the whitepaper gives the full argument.

Linear exposure at L = 2​

Curve Cryptoswap LP value scales approximately as Vc∝pV_c \propto \sqrt{p}. Substituting into (2.5):

V∗∝(p) L=p L/2.(2.6)V_* \propto (\sqrt{p})^{\,L} = p^{\,L/2}. \tag{2.6}

Set L=2L = 2:

V∗∝p(2.7)\boxed{V_* \propto p} \tag{2.7}

Result. With L=2L = 2, the position tracks BTC one-to-one. The leverage straightens the concave p\sqrt{p} curve, while trading fees continue to accrue.

Exposure at other leverage values​

Other leverage values do not give linear exposure:

  • L>2L > 2: V∗∝pL/2V_* \propto p^{L/2}. The position outperforms a plain hold when the price rises and underperforms it when the price falls.
  • L<2L < 2: The position under-hedges the p\sqrt{p} curve and still has residual IL.

L=2L = 2 is the only value that makes exposure linear in price. At L=2L = 2, the debt equals the LP's stablecoin side on average. So the stablecoin side can repay the debt when the position closes.


LEVAMM and VirtualPool​

On the canonical position, LEVAMM holds Curve LP tokens worth $200,000 against $100,000 of crvUSD debt. The position is worth $100,000 at 2× leverage, Eq (3.1). Arbitrage trades against LEVAMM keep the debt near half of the collateral value.

To keep leverage fixed at L=2L = 2 (debt = 50% of collateral value), YieldBasis uses a second AMM, LEVAMM. It holds Curve LP tokens on one side and implicit crvUSD debt on the other. An oracle price pop_o anchors it: the USD price of one Curve LP token from CryptopoolLPOracle. In this section, yy counts LP tokens, so poyp_o y is the collateral value. The VirtualPool is the contract that wraps LEVAMM, Cryptoswap, and a flash loan to offer direct swaps between crvUSD and the asset, in both directions.

Ideal debt at the oracle price​

If the live market price equals the oracle price pop_o, "perfect" leverage is:

d~  =  L−1L po y~(ideal debt when p=po),(3.1)\tilde{d} \;=\; \frac{L-1}{L}\,p_o\,\tilde{y} \qquad\text{(ideal debt when } p = p_o\text{)}, \tag{3.1}

where y~\tilde{y} is the LP amount in LEVAMM at that oracle touch point. A tilde marks an ideal value.

For L=2L = 2: d~=12poy~\tilde{d} = \tfrac{1}{2} p_o \tilde{y}.

LEVAMM invariant and pricing​

Define x≡x0(po)−dx \equiv x_0(p_o) - d. The LEVAMM uses a constant-product-like invariant:

(x0(po)−d)  y  =  I(po),(3.2)\big(x_0(p_o) - d\big)\; y \;=\; I(p_o), \tag{3.2}

with I(po)I(p_o) constant as long as pop_o stays fixed.

At p=pop = p_o, the instantaneous price of LEVAMM should equal the oracle price:

x0(po)−d~y~=po.(3.3)\frac{x_0(p_o) - \tilde{d}}{\tilde{y}} = p_o. \tag{3.3}

Substitute d~\tilde{d} from (3.1):

x0(po)=2L−1L po y~.(3.4)x_0(p_o) = \frac{2L - 1}{L}\,p_o\,\tilde{y}. \tag{3.4}

Anchor term x₀ for any y and d​

Away from the ideal point, y~\tilde{y} is not known directly. From (3.4):

y~  =  L2L−1 x0po.(3.5)\tilde{y} \;=\; \frac{L}{2L - 1}\,\frac{x_0}{p_o}. \tag{3.5}

Evaluate the invariant at the ideal point:

I(po)  =  (x0−d~) y~  =  (x0−L−1Lpoy~)y~.(3.6)I(p_o) \;=\; \big(x_0 - \tilde{d}\big)\,\tilde{y} \;=\; \left(x_0 - \frac{L-1}{L} p_o \tilde{y}\right)\tilde{y}. \tag{3.6}

Set that equal to the current-state invariant (x0−d) y(x_0 - d)\,y, substitute (3.5), and rearrange. The result is a quadratic in x0x_0:

x02(L2L−1)2−poy x0+poy d=0.(3.7)x_0^{2}\left(\frac{L}{2L-1}\right)^{2} - p_o y\,x_0 + p_o y\,d = 0. \tag{3.7}

Choose the larger root, which matches the ideal state:

x0(po)=poy+(poy)2−4 po y d (L2L−1)22(L2L−1)2(3.8)\boxed{ x_0(p_o) = \frac{p_o y + \sqrt{(p_o y)^2 - 4\,p_o\,y\,d\,\left(\tfrac{L}{2L-1}\right)^{2}}} {2\left(\tfrac{L}{2L-1}\right)^{2}} } \tag{3.8}

For L=2L = 2, the code simplifies the numbers. The equations here keep the general form.

Position value and invariant at the oracle price​

The pool value at the oracle price is a sandwich-resistant valuation:

V  =  y~ po−d~  =  1L y~ po  =  x02L−1.(3.9)V \;=\; \tilde{y}\,p_o - \tilde{d} \;=\; \frac{1}{L}\,\tilde{y}\,p_o \;=\; \frac{x_0}{2L - 1}. \tag{3.9}

In closed form, the invariant is:

I(po)  =  (x0−d~) y~  =  x02po(L2L−1)2.(3.10)I(p_o) \;=\; \big(x_0 - \tilde{d}\big)\,\tilde{y} \;=\; \frac{x_0^{2}}{p_o}\left(\frac{L}{2L-1}\right)^{2}. \tag{3.10}

An alternative expression for VV follows from (3.10):

V  =  2 I(po) po−x0.(3.11)V \;=\; 2\,\sqrt{I(p_o)\,p_o} - x_0. \tag{3.11}

Flash-loan sizing (φ)​

The arbitrageur brings xx crvUSD, or needs extra. The VirtualPool computes how much crvUSD to flash-borrow. The goal is to add or remove Curve liquidity in balance (no spot price move) and to repay the flash loan in the same transaction.

Let:

  • ff: LEVAMM fee
  • dd: current debt
  • yy: LP amount in the LEVAMM
  • x0x_0: anchor term from Eq. (3.8)
  • xx: crvUSD that the arbitrageur provides for this swap (not the xx of §1 or Eq (3.2))
  • xc,yc,Scx_c, y_c, S_c: Curve pool's stablecoin reserves, crypto reserves, total LP supply

Define

r  =  xcSc (1−f).(3.12)r \;=\; \frac{x_c}{S_c}\,(1 - f). \tag{3.12}

The required flash amount ϕ\phi solves the quadratic (whitepaper Eq. 39):

ϕ2+ϕ(x0−d+x−r y)−y x r=0.(3.13)\phi^{2} + \phi\big(x_0 - d + x - r\,y\big) - y\,x\,r = 0. \tag{3.13}

The discriminant is:

D  =  (x0−d+x−r y)2+4 y x r.(3.14)D \;=\; \big(x_0 - d + x - r\,y\big)^2 + 4\,y\,x\,r. \tag{3.14}

Choose the positive root:

ϕ=D−(x0−d+x−r y)2(3.15)\boxed{ \phi = \frac{\sqrt{D} - (x_0 - d + x - r\,y)}{2} } \tag{3.15}

The VirtualPool evaluates this before it executes the swap. The LP redemption and LEVAMM trade proceeds then cover the flash loan exactly.

Arbitrage direction​

The arbitrage trade depends on which side of the 50% target the debt sits:

  • Debt too low (price up): d/Vc<0.5d/V_c < 0.5. Then x0−dx_0 - d is large → LP is "expensive" in crvUSD. The arbitrageur brings the asset, mints LP with it and flash-borrowed crvUSD, and sells the LP to the LEVAMM. The LEVAMM debt increases.
  • Debt too high (price down): d/Vc>0.5d/V_c > 0.5. Then x0−dx_0 - d is small → LP is "cheap". The arbitrageur buys LP, unwraps it, and repays debt.

All legs (flash loan, LP mint/burn, CDP mint/repay) run atomically in the VirtualPool wrapper.

Safe debt bounds​

The protocol enforces safe bounds on the debt ratio. On the canonical position, with $200,000 of collateral, the band runs from $12,500 to $106,250 of debt:

  • MIN_SAFE_DEBT =14L2= \dfrac{1}{4L^2} of collateral value. At L=2L = 2: 116=6.25%\tfrac{1}{16} = 6.25\% (prevents under-leveraging edge cases).
  • MAX_SAFE_DEBT =(2L−1)24L2−18L2= \dfrac{(2L-1)^2}{4L^2} - \dfrac{1}{8L^2} of collateral value. At L=2L = 2: 916−132=1732=53.125%\tfrac{9}{16} - \tfrac{1}{32} = \tfrac{17}{32} = 53.125\%.

For L=2L = 2, the critical debt value corresponds to pAMM=916pop_{\text{AMM}} = \tfrac{9}{16} p_o. MAX_SAFE_DEBT sits a 132\tfrac{1}{32} buffer below that 916\tfrac{9}{16} mathematical limit.

A deposit reverts with "Unsafe min" or "Unsafe max" if it leaves debt outside the band. So does a LEVAMM trade that moves debt further from the target. The band does not block withdrawals, which take a proportional share of collateral and debt.


Net APR and cost terms​

This section gives the return of an unstaked yb-LP position, in the deposited asset. Every rate in it is a simple APR: a yearly rate on the position value, not compounded. Eq (4.9) converts it to a compounded rate. On the canonical $100,000 position, a net rate of 10% APR is $10,000 a year if the rate stays the same.

These are model rates. Fundamental yield (FT APY), the rate that the docs quote for unstaked yb-LP, comes from measured Fundamental Value growth over a trailing window. The equations here do not compute it.

Return components​

Let:

  • rpoolr_{\text{pool}}: the rate that the Curve BTC/crvUSD pool earns without leverage (pure trading fees, in BTC terms). On a pool that runs the oracle-report policy (YBOraclizedPolicy), the policy sets the fee of each swap. For what each policy sets, read Pool policies.
  • LL: compounding leverage (YieldBasis: L=2L = 2).
  • rborrowr_{\text{borrow}}: effective borrow rate on the protocol's crvUSD line (set by governance).
  • rreleverager_{\text{releverage}}: the rebalancing cost, the rate lost to keeping leverage constant (AMM fees and price gaps paid to arbitrageurs, and slippage).
  • rrefuelr_{\text{refuel}}: the refueling offset from recycled borrower interest, Eq (4.7).

Because the protocol supplies twice as much notional liquidity (BTC plus borrowed crvUSD) to Curve, gross fee flow scales approximately linearly with LL:

Gross fee APR  =  L⋅rpool.(4.1)\text{Gross fee APR} \;=\; L \cdot r_{\text{pool}}. \tag{4.1}

For L=2L = 2:

Gross fee APR  =  2 rpool.(4.2)\text{Gross fee APR} \;=\; 2\,r_{\text{pool}}. \tag{4.2}

The net rate subtracts two costs from the gross fee rate:

  • Borrow interest: the interest paid on the crvUSD debt.
  • Rebalancing cost: the continuous loss to the arbitrageurs who keep the debt ratio at 50%.

Subtracting both costs from Eq (4.1) gives the net rate:

APRnet=L rpool−(rborrow+rreleverage)(4.3)\boxed{ \text{APR}_{\text{net}} = L\,r_{\text{pool}} - \bigl(r_{\text{borrow}} + r_{\text{releverage}}\bigr) } \tag{4.3}

For YieldBasis' fixed L=2L = 2:

APRnet=2 rpool−(rborrow+rreleverage)(4.4)\boxed{ \text{APR}_{\text{net}} = 2\,r_{\text{pool}} - \bigl(r_{\text{borrow}} + r_{\text{releverage}}\bigr) } \tag{4.4}

Rebalancing cost heuristic​

The whitepaper gives an empirical rule of thumb from simulation. The rebalancing cost rreleverager_{\text{releverage}} is about 2× the fee APR of an optimized constant-product pool without leverage, rxy=koptr_{xy = k}^{\text{opt}}.

So the method fails on a pure x⋅y=kx\cdot y = k AMM, where fees are too small. It works on Curve Cryptoswap, where rpoolr_{\text{pool}} is higher. The contracts do not hard-code the rule below. It is a modeling shortcut:

rreleverage≈2⋅rxy=kopt(empirical).(4.5)r_{\text{releverage}} \approx 2 \cdot r_{xy = k}^{\text{opt}} \quad \text{(empirical)}. \tag{4.5}

Realized return: pool profit split and refueling​

Equations (4.1)–(4.4) are the theoretical model of the whitepaper. Two effects shift the realized numbers: the profit split inside Cryptoswap, and refueling.

Cryptoswap's internal profit split. The pool protects a fraction ρ\rho of its fee profit for LPs (lp_xcp_profit). ρ\rho is the reserved profit fraction. price_scale moves (changes to the pool's internal price) can spend the rest. When the pool re-pegs (moves price_scale) often, LPs keep about ρ\rho of the fee profit (with a zero pool admin fee). On the older pools of markets 0 to 6, ρ\rho is one half. On v3 pools, the Curve DAO sets ρ\rho per pool. To check, call reserved_profit_fraction() on the pool. The realized pool rate is then approximately:

rpool,realised  ≈  ρ⋅rpool,raw.(4.6)r_{\text{pool,realised}} \;\approx\; \rho \cdot r_{\text{pool,raw}}. \tag{4.6}

LEVAMM's own trading fees add to this.

Refueling loop. Borrower interest does not go to an external creditor. LT collects it from LEVAMM and donates all of it to the Cryptoswap pool. There it pays for price_scale moves. At steady state, the interest paid funds rebalancing. So rborrowr_{\text{borrow}} and part of rreleverager_{\text{releverage}} cancel through the donation flow:

rrefuel  ≈  rborrow(steady state).(4.7)r_{\text{refuel}} \;\approx\; r_{\text{borrow}} \quad \text{(steady state)}. \tag{4.7}

Net realised LP drag is the residual rreleverage−rrefuelr_{\text{releverage}} - r_{\text{refuel}}, not rborrow+rreleverager_{\text{borrow}} + r_{\text{releverage}}:

APRnet,realised≈L rpool,realised−(rreleverage−rrefuel)(4.8)\boxed{ \text{APR}_{\text{net,realised}} \approx L\,r_{\text{pool,realised}} - \bigl(r_{\text{releverage}} - r_{\text{refuel}}\bigr) } \tag{4.8}

Eq. (4.4) remains useful as the envelope of the whitepaper model. Eq. (4.8) describes what an LP sees onchain.

APR and compounded rate​

With continuous compounding, the annual percentage yield (APY) is:

APYnet=exp⁡ ⁣(APRnet)−1.(4.9)\text{APY}_{\text{net}} = \exp\!\big(\text{APR}_{\text{net}}\big) - 1. \tag{4.9}

The gap grows with the rate. At 5% APR the difference is 13 basis points (bp). At 10% it is 52 bp: on the $100,000 position, $10,517 a year compounded against $10,000 simple. At 20% it is 214 bp.

Takeaway. A yb-LP position earns when the doubled fee stream is larger than the rebalancing cost that remains after refueling, Eq. (4.8). The whitepaper envelope, Eq. (4.4), also subtracts borrow interest. Governance sets the borrow rate and the AMM fee.


Admin-fee curve and staked accounting​

LT splits each fee gain between unstaked yb-LP holders, who want fees in BTC or ETH, and admin fees. An admin-fee curve sets the split. The curve depends on the staking ratio, the share of yb-LP that is staked. The FeeSplitter then sends a DAO-set share (split_fraction()) of admin fees to the net-pressure reserve and the rest to veYB holders. For the fee flow, and for a table that evaluates Eq (5.1) at four staking ratios and at the full-staking limit, read Fees and veYB revenue.

Admin-fee formula​

Let:

  • TT = total yb-LP supply,
  • ss = amount of yb-LP staked,
  • fmin⁡f_{\min} = minimum admin fee when nobody stakes,
  • faf_a = actual admin-fee fraction.

The curve is:

fa  =  1−(1−fmin⁡) 1−sT(5.1)\boxed{ f_a \;=\; 1 - (1 - f_{\min}) \, \sqrt{1 - \frac{s}{T}} } \tag{5.1}

The curve has two limits:

  • s=0⇒fa=fmin⁡s = 0 \Rightarrow f_a = f_{\min} (unstaked LPs keep 1−fmin⁡1-f_{\min} of fees).
  • s=T⇒fa→1s = T \Rightarrow f_a \to 1 (all fee gains become admin fees; stakers already give up fee growth for YB emissions).

The square root makes the increase gentle at first, so early stakers do not take a large share from unstaked LPs. The increase then accelerates near full staking, which prevents an "everyone stakes, no one gets fees" equilibrium.

Gain and loss sharing​

At each accounting tick (a deposit, a withdrawal, or a checkpoint), let:

  • v−1v_{-1} = total value of the leveraged position (in BTC terms) before fees this period,
  • v1v_1 = total value after market moves and fees, before LT allocates anything,
  • Δv=v1−v−1\Delta v = v_1 - v_{-1} = value change.

Further, let vsv_s and vs∗v_s^* be the staked bucket's current value and watermark. Then vs,loss=max⁡(vs∗−vs,0)v_{s,\text{loss}} = \max(v_s^* - v_s, 0) is the outstanding watermark shortfall.

LT applies the admin fee in three regimes, which match the regime split inside LT's value-update routine (_calculate_values):

Recovery regime (watermark open, vs,loss>0v_{s,\text{loss}} > 0, Δv>0\Delta v > 0):

The first part of the gain, up to the amount that restores the staked watermark, pays no admin fee. The admin fee applies only to the rest:

vloss  =  min⁡ ⁣(Δv,  vs,loss⋅Ts),(5.2a)v_{\text{loss}} \;=\; \min\!\left(\Delta v,\; v_{s,\text{loss}} \cdot \frac{T}{s}\right), \tag{5.2a} Δvuse  =  vloss+(Δv−vloss)(1−fa),(5.2b)\Delta v_{\text{use}} \;=\; v_{\text{loss}} + (\Delta v - v_{\text{loss}})(1 - f_a), \tag{5.2b} Δa  =  (Δv−vloss) fa.(5.2c)\Delta a \;=\; (\Delta v - v_{\text{loss}})\,f_a. \tag{5.2c}

Post-recovery regime (vs,loss=0v_{s,\text{loss}} = 0, Δv>0\Delta v > 0):

Admin fee applies to the whole gain:

Δvuse  =  Δv (1−fa),Δa  =  Δv fa.(5.3)\Delta v_{\text{use}} \;=\; \Delta v\,(1 - f_a), \qquad \Delta a \;=\; \Delta v\,f_a. \tag{5.3}

Loss regime (Δv≤0\Delta v \leq 0):

No admin fee applies to a loss: Δvuse=Δv\Delta v_{\text{use}} = \Delta v, Δa=0\Delta a = 0 (LT.vy _calculate_values).

Small-stake case (s<1016s < 10^{16} base units, that is 0.01 staked yb-LP, MIN_STAKED_FOR_FEES): the three regimes do not apply. The admin fee applies to gains and losses alike: Δvuse=Δv (1−fa)\Delta v_{\text{use}} = \Delta v\,(1 - f_a) and Δa=Δv fa\Delta a = \Delta v\,f_a, for any sign of Δv\Delta v.

Losses split pro rata between the staked and unstaked buckets:

Δvs  =  Δvuse⋅sT,Δvus  =  Δvuse−Δvs.(5.4)\Delta v_s \;=\; \Delta v_{\text{use}} \cdot \frac{s}{T}, \qquad \Delta v_{us} \;=\; \Delta v_{\text{use}} - \Delta v_s. \tag{5.4}

For any gain (Δvuse>0\Delta v_{\text{use}} > 0), LT caps the staked share at the watermark shortfall. With no watermark gap, the staked side gets no share of the gain:

Δvs  =  min⁡ ⁣(Δvuse⋅sT,  vs,loss).(5.5)\Delta v_s \;=\; \min\!\left(\Delta v_{\text{use}} \cdot \frac{s}{T},\; v_{s,\text{loss}}\right). \tag{5.5}

The unstaked bucket gets the rest:

Δvus  =  Δvuse−Δvs.(5.6)\Delta v_{us} \;=\; \Delta v_{\text{use}} - \Delta v_s. \tag{5.6}

Intent. LT charges no admin fee on a gain until the staked side's share of it has covered the staked loss. Staked and unstaked holders share that gain pro rata by balance, and LT caps the staked share at the staked loss.

Negative rebase of staked supply​

Staked yb-LP rebases down when the value that LT allocates to stakers (after fees) is less than proportional to total value. Let:

  • v1′v_1' = new total value after admin fee (v−1+Δvusev_{-1} + \Delta v_{\text{use}}),
  • vs′v_s' = new staked value after sharing profit/loss,
  • ss = staked token supply before rebase,
  • TT = total token supply before rebase,
  • δs\delta s = staked tokens burned (negative rebase).

The value share must match the token share:

s−δsT−δs  =  vs′v1′.(5.7)\frac{s - \delta s}{T - \delta s} \;=\; \frac{v_s'}{v_1'}. \tag{5.7}

Solve for δs\delta s:

δs=s v1′−T vs′ v1′−vs′ (5.8)\boxed{ \delta s = \frac{s\,v_1' - T\,v_s'}{\,v_1' - v_s'\,} } \tag{5.8}

The supplies after the rebase are:

snew=s−δs,Tnew=T−δs.(5.9)s_{\text{new}} = s - \delta s, \qquad T_{\text{new}} = T - \delta s. \tag{5.9}

Numerical cap. As v1′→vs′v_1' \to v_s' (staking ratio approaches 100%), the denominator in (5.8) collapses, and in the continuous model δs\delta s diverges. Onchain, the contract caps it by clamping the per-step rebase to:

δsmax⁡  =  ∣Δv⋅Tv−1+Δv+1⋅1−faϵmin⁡∣,(5.10)\delta s_{\max} \;=\; \left|\frac{\Delta v \cdot T}{v_{-1} + \Delta v + 1} \cdot \frac{1 - f_a}{\sqrt{\epsilon_{\min}}}\right|, \tag{5.10}

where ϵmin⁡=10−4\sqrt{\epsilon_{\min}} = 10^{-4} (SQRT_MIN_UNSTAKED_FRACTION), so ϵmin⁡=10−8\epsilon_{\min} = 10^{-8} is the floor on the unstaked fraction. When the unstaked fraction is below that floor (the staking ratio is above 1−10−81 - 10^{-8}), the cap limits δs\delta s so that it does not diverge. For the onchain constant name and its exact integer scale, read Dev: LT.

Unstaked tokens never rebase. They gain (or lose) value through the (1−fa)(1-f_a) fee stream.

Intuition. Stakers opt into emissions instead of cash fees. If their side under-earns because of earlier losses, LT cuts their token count (negative rebase). Each remaining token then still holds its fair slice of vs′v_s'.


Pages that cite these equations​

Each page in the table summarizes a result and cites equations from this primer:

Topic pageCites
Arbitrage and MEV§3: flash-loan sizing, Eq (3.15)
Compounding leverage§1 and §2: the √p law and the 2× leverage identity, Eq (1.7), (2.5), (2.7)
Fees and veYB revenue§5: admin-fee curve faf_a, Eq (5.1); recovery-first sharing, Eq (5.2a)–(5.6)
Volatility decay§1: √p law and IL, Eq (1.6)–(1.9). §2: the L=2L=2 case, Eq (2.5)–(2.7). §4: net APR, Eq (4.3)–(4.8). §5: gain and loss sharing, Eq (5.2a)–(5.6)
yb-LP share value derivation§3: anchor term and value at the oracle price, Eq (3.8), (3.9)