Math Primer
0. Notation & Symbols
Symbol | Meaning |
---|---|
BTC spot price in USD | |
Oracle BTC/USD price used by the Rebalancing‑AMM | |
Value of collateral (Curve LP tokens) | |
Value of the leveraged position (after borrowing) | |
Outstanding crvUSD debt | |
Compounding leverage factor (fixed to 2 in YieldBasis) | |
LP token amount held by the Rebalancing‑AMM | |
Anchor term in the Rebalancing‑AMM pricing formula | |
Invariant constant of the Rebalancing‑AMM for a fixed oracle price | |
Flash‑loan size (crvUSD) solved via a quadratic | |
Admin‑fee fraction routed to veYB | |
Minimum admin fee when nobody stakes | |
Staked vs total supply of ybBTC | |
Fee APR earned by the underlying Curve pool (unlevered) | |
Borrow APR on the crvUSD CDP line | |
Effective APR “cost” of maintaining leverage (rebalancing losses/subsidy) |
1. The Constant‑Product Problem (Why Shows Up)
Classic AMMs (e.g. Uniswap v2) enforce
where is the USD side and is the BTC side. Let the external BTC price be (USD per BTC).
1.1 Normalising the start
Assume you deposit equal USD value at :
- USD
- BTC (worth $1 at )
So
1.2 After a price move
Arbitrage pushes the AMM price to . In a constant‑product AMM,
Combine (1.1) and (1.3):
With :
1.3 LP value scales as
Ignoring fees, LP USD value is
We started with $2 total, so per‑initial‑dollar scaling is
1.4 Impermanent loss (IL)
If you just held instead:
Impermanent loss (relative underperformance) is
Since for any , : the LP underperforms HODLing whenever price drifts.
Takeaway. Constant‑product LP value . Other, more complicated, AMM formulae are not immune to the IL problem either, and the source thereof is the sublinearity of the value function, for which reason the only way of eliminating IL is to design an AMM with an at least a linear value function. YieldBasis provides such a design by engineering exposure to scale linearly with , not as .
2. Compounding Leverage — Turning into
YieldBasis borrows against the LP collateral to keep a constant compounding leverage of .
2.1 Defining “compounding leverage”
By construction, the protocol keeps debt at a fixed fraction of collateral:
So the net position value is
Consider a small change in collateral value . After re‑leveraging to restore the ratio, the relative change of is amplified by :
Integrate both sides:
Exponentiate:
Why is the relative change amplified?
Growth of the price of collateral
If the collateral grows in price, the value changes as ( is kept constant at this step):
Adjustment of the debt value and of the collateral amount
By definition: Then: Whence it follows that
As in this step the value of the leveraged position tracks the value of the collateral linearly, the total scaling factor is exactly equal to the scaling factor of the previous step. For more details, refer to the General Idea section of the Whitepaper.
2.2 Pick to linearise BTC exposure
Curve Cryptoswap LP value scales approximately as . Plug that in:
Set :
Result: With , your position tracks BTC 1:1 — the curvature (and thus impermanent loss) is eliminated while you still earn trading fees.
2.3 What if ?
- : — outperform on the way up, underperform on the way down (re‑introduces divergence vs. “just hold”).
- : You under‑hedge the curve and still suffer residual IL.
Hence, locking is the sweet spot: linear BTC exposure, zero IL, and manageable debt that can always be unwound with the LP’s USD side.
3. Rebalancing‑AMM & Virtual Pool
To keep leverage fixed at (i.e. debt = 50% of value), YieldBasis uses a second AMM (“Rebalancing‑AMM”). It holds Curve LP tokens on one side and implicit crvUSD debt on the other, and is anchored to an oracle price (BTC/USD).
We first state the target (“ideal”) state at , then derive the invariant and solve for the anchor variable .
3.1 Ideal debt at the oracle price
If the live market price equals the oracle price , “perfect” leverage is:
where is the LP amount in the AMM at that oracle touch point (tildes = “ideal” values).
For : .
3.2 Rebalancing‑AMM Invariant & Pricing
Define . The Rebalancing‑AMM uses a constant‑product‑like invariant:
with constant as long as stays fixed.
At , the AMM’s instantaneous price should equal the oracle:
Substitute from (3.1):
3.3 Solving for with arbitrary
Away from the ideal point, we don’t know directly. From (3.4):
Evaluate the invariant at the ideal point:
Set that equal to the current‑state invariant , substitute (3.5), and rearrange. You obtain a quadratic in :
Choose the larger root (matches the ideal‑state intuition):
For , you can simplify numerically in code, but keep the general form for clarity.
3.4 Useful derived quantities
Pool value at oracle price. It’s cleaner to value the AMM at to avoid sandwich games:
Invariant in closed form.
An alternative expression for follows from (3.10):
3.5 Flash‑Loan Sizing ()
When the arbitrageur comes with crvUSD (or needs extra), the Virtual Pool computes how much crvUSD to flash‑borrow so that:
- Curve liquidity is added/removed symmetrically (no spot price move),
- The flash loan is repaid inside the same tx.
Let:
- — Rebalancing‑AMM fee
- — current debt
- — LP amount in the Rebalancing‑AMM
- — anchor term from Eq. (3.8)
- — user‑provided crvUSD for this swap
- — Curve pool’s stablecoin reserves, crypto reserves, total LP supply
Define a convenience constant
The required flash amount solves the quadratic (whitepaper Eq. 39):
Discriminant:
Choose the positive root:
This is evaluated inside the Virtual Pool before executing the swap, ensuring the flash loan is exactly covered by the LP redemption and AMM trade proceeds.
3.6 Directional intuition (no new math)
- Debt too low (price up): . Then is large → LP is “expensive” in crvUSD. Arb brings in crvUSD, mints LP, increases .
- Debt too high (price down): . Then is small → LP is “cheap”. Arb buys LP, unwraps, repays debt.
All legs (flash‑loan, LP mint/burn, CDP mint/repay) run atomically in the Virtual Pool wrapper.
4. Net APR & Cost Terms
We want an explicit expression for the BTC‑denominated return of an unstaked ybBTC position.
4.1 Components
Let
- — APR the Curve BTC/crvUSD pool would earn without leverage (pure trading fees, in BTC terms).
- — compounding leverage (YieldBasis: ).
- — effective borrow APR on the protocol’s crvUSD line (set by governance).
- — drag from maintaining constant leverage (AMM fees/price edge paid to arbs, flash‑loan interest, slippage).
Because we supply twice as much notional liquidity (BTC + borrowed crvUSD) to Curve, fee flow scales ~linearly with :
For :
We then subtract the two costs:
- Borrow cost — interest paid on the crvUSD debt.
- Rebalancing cost — continuous “leak” to arbitrageurs that keep the ratio at 50%.
Putting it together:
For YieldBasis’ fixed :
4.2 Heuristic for
Backtests (Jan 2019 – Oct 2024) show:
- Optimised constant‑product pools (no leverage) earn APR over that window.
- Empirically, that value — the “cost” of keeping leverage perfect is roughly twice what a plain Uniswap‑style pool can earn under the same conditions.
This is why the method fails on a pure AMM (fees not big enough), but works on Curve Cryptoswap where is materially higher.
We do not hard‑code this heuristic on‑chain; it’s just a modelling shortcut:
4.3 Continuous vs. discrete compounding
All rates above are quoted as simple APRs for intuition. If you want continuous compounding:
Given the relatively small magnitudes (single‑digit percentages for costs, double‑digit for fees), APR ≈ APY within a few bps, so we stick to APR in docs.
Takeaway. YieldBasis only “wins” if the doubled fee stream outpaces borrow + rebalance drag. Governance controls those drags (via borrow rate and AMM params), keeping net APR attractive in most regimes.
5. Token Incentives & Admin‑Fee Function
YieldBasis splits real fee flow between unstaked LPs (they want BTC fees) and veYB stakers (they want protocol value capture). The split is governed by an admin‑fee curve that depends on how much of the liquidity is staked.
5.1 Admin‑fee formula
Let
- = total ybBTC supply (all LP shares),
- = amount of ybBTC staked (earning YB emissions),
- = minimum admin fee when nobody stakes,
- = actual admin‑fee fraction skimmed from fees and sent to veYB.
The curve:
Limits:
- (LPs keep of fees)
- (all fees to veYB; stakers opted out of fee yield anyway)
The square‑root makes the increase gentle at first (so early stakers don’t massively penalize LPs), then accelerates near full staking to avoid “everyone stakes, no one gets fees” equilibria.
5.2 Splitting fee gains / sharing losses
After each accounting tick (or harvest), let
- = total value of the leveraged position (in BTC terms) before fees this period,
- = total value after market moves + fees, before admin fee is taken,
- = value left for LPs after admin fee,
- = admin fee sent to veYB.
We split between staked and unstaked portions:
-
If (loss): share it pro‑rata by stake.
-
If (profit): first bring staked value back up to its “ideal” target (if previous losses hit stakers), then split the remainder pro‑rata.
Unstaked side gets whatever is left:
5.3 Negative rebase for staked supply
Staked ybBTC rebases down when value allocated to stakers (after fees) is less than proportional to total value. Let
- = new total value after admin fee (i.e. ),
- = new staked value after sharing profit/loss,
- = staked token supply before rebase,
- = total token supply before rebase,
- = how many staked tokens are burned (negative rebase).
We want the value share to match the token share:
Solve for :
So the post‑rebase supplies become:
Unstaked tokens never rebase; they simply accumulate (or lose) value via the fee stream.
Intuition. Stakers opt into emissions instead of cash fees. If their side under‑earns (because they took earlier losses), their token count is cut (negative rebase) so each remaining token still represents its fair slice of .