Re-Leverage Arbitrage — Toy Example Workflow

Step-by-step mechanics of the VirtualPool re-leverage arbitrage for the Yield Basis LEVAMM with 2× leverage (WBTC market).

CryptoPool1M crvUSD / 10 BTCLP Supply2,000,000Collateral200,000 LPDebt100,000 crvUSDLeverageLEV_RATIO4/9Fee0.3%

1Initial State (T0) — Balanced, BTC = 100,000 crvUSD

Curve CryptoPool
stables (crvUSD)1,000,000
BTC10.0000
LP supply2,000,000
price_scale100,000 crvUSD/BTC
LP oracle price1.0000 crvUSD/LP
LEVAMM StateDTV = 50.00%
collateral200,000 LP
debt100,000 crvUSD
x₀ (computed)300,000.00
x₀−debt (x_initial)200,000.00
invariant k = x₀×coll40,000,000,000
LEVAMM price/LP1.0000 crvUSD/LP
Premium vs oracle0.00%
At DTV = 50%: x₀ = 3 × debt = 300,000  |  x_initial = 2 × debt = 200,000  |  LEVAMM marginal price = x_initial / collateral = 200,000 / 200,000 = 1.00 crvUSD/LP — exactly equal to the oracle LP price. No premium, no discount. The system is at equilibrium.

2After BTC Pump (T1) — BTC = 110,000, price_scale still lagging at 100,000

CryptoPool (after ext. arb)
stables (crvUSD)1,048,808.85
BTC9.534626 BTC
price_scale100,000 (lagging!)
LP price @ market1.048809 crvUSD/LP
LP price @ scale1.001136 crvUSD/LP
LEVAMM StateDTV = 47.67%Premium
collateral200,000 LP (unchanged)
debt100,000 crvUSD (unchanged)
x₀ @ new oracle328,129.17 (grew!)
x_initial = x\u2080\u2212debt228,129.17
Δ x_initial+28,129.17
LEVAMM price/LP (no fee)1.140646 crvUSD/LP
Oracle LP price1.048809 crvUSD/LP
Marginal premium+8.76%
Why does x₀ grow? cv = p₀ × collateral = 1.048809 × 200,000 = 209,761.77. The formula x₀ = (cv + √(cv² − 4·cv·4/9·debt)) / (2·4/9) yields a larger x₀ because cv grew. Since debt is unchanged, x_initial = x₀ − debt grows by 28,129 crvUSD. LEVAMM now bids 8.76% above oracle LP price.

3Workflow Diagram — VirtualPool Re-Leverage Arbitrage (i = 1)

Arbitrageur
EOA / Bot
0.001 BTC
(= 110.00 crvUSD)
VirtualPool.exchange
i = 1  (BTC → crvUSD)
in0.001 BTC
out127.4512 crvUSD
internally:
1Flash Loan
Borrow crvUSD proportional to BTC input
flash = in × S / B
      = 0.001 × 1,048,808.85 / 9.534626
      = 110.00 crvUSD
2add_liquidity
Symmetric deposit: flash + BTC → LP tokens
in: 110.00 crvUSD + 0.001 BTC
lp = supply × in / B
   = 2,000,000 × 0.001 / 9.534626
   = 209.7618 LP
3LEVAMM.exchange(1, 0, LP)
Sell LP to LEVAMM, receive crvUSD (hyperbolic curve)
x_initial  = 228,129.17
y_after    = 200,209.7618
x_after    = ⌈x_init × coll / y_after⌉ = 227,891
gross      = 238.1657 crvUSD
out (0.3% fee) = 237.4512 crvUSD
4Repay Flash & Collect Profit
LEVAMM paid: +237.45 crvUSD
Repay flash: −110.00 crvUSD
Net out: +127.4512 crvUSD
BTC cost: −110.0000 crvUSD
PROFIT: +17.4512 crvUSD
       (+15.865% on BTC cost)

4LEVAMM State Change — Before vs After Re-Leverage Arbitrage

MetricBefore (T1)After arbDelta
Collateral (LP)200,000.00200,209.76+209.7618
Debt (crvUSD)100,000.00100,237.45+237.4512
x₀ (virtual reserve)328,129.17328,133.18+4.0151
DTV47.67%47.74%+0.06%
Both collateral AND debt increase. LEVAMM is re-leveraged: it now holds more LP collateral, funded by more crvUSD debt. DTV moves from 47.67% toward the 50% target (now 47.74%). The “premium” paid to the arbitrageur is the protocol’s cost to restore its 2× leverage target — analogous to option theta cost for maintaining delta exposure.

5DTV Sensitivity — Profit vs Oracle LP Price Deviation

Oracle LPDTVLEVAMM/LPPremiumout_amtBTC costNet ProfitProfit %Note
0.950052.63%0.8398-11.60%65.121189.2737-24.1526-27.05%
0.980051.02%0.9387-4.22%85.804595.5665-9.7620-10.21%
1.000050.00%1.0000+0.00%99.000099.7618-0.7618-0.76%T0 balanced
1.020049.02%1.0589+3.81%111.5289103.9570+7.5719+7.28%
1.050047.62%1.1440+8.95%129.2201110.2499+18.9702+17.21%
1.048847.67%1.1406+8.76%128.1657110.0000+18.1657+16.51%T1 actual
1.080046.30%1.2261+13.53%146.3502116.5427+29.8075+25.58%
1.100045.45%1.2796+16.33%157.2422120.7379+36.5043+30.23%
1.150043.48%1.4102+22.63%184.6167131.2260+53.3906+40.69%
Profit is positive when DTV < 50% (BTC price rose, oracle LP price rose). At small input (0.001 BTC) price impact is negligible, so profit % ≈ marginal premium. At larger inputs the hyperbolic curve’s price impact erodes the premium — this is why real arbitrageurs trade in small increments or use TWAP execution. Break-even around DTV ≈ 50%.

6De-Leverage Direction (T2) — BTC Drops to 90,000

T2 State: DTV > 50%
BTC market price90,000 crvUSD
LP oracle price0.948683 crvUSD
LEVAMM DTV52.70% (> 50%)
x₀ (shrank)267,042.47
x_initial167,042.47
LEVAMM/LP discount-11.96%
Arb directioni = 0 (crvUSD → BTC)
i=0 Step-by-Step (in = 1,000 crvUSD)
r0fee = S*(1-fee)/supply0.474342
K = r0fee * collateral94,868.33
b = x₀−debt + in − K73174.14
D = b\u00b2 + 4*K*in5,733,927,874.41
flash = (\u221aD \u2212 b) / 21274.28 crvUSD
out_BTC = flash * B / S0.01416 BTC
BTC value at 90,0001,274.28 crvUSD
Cost (crvUSD in)1,000 crvUSD
Net Profit+274.28 crvUSD (+27.43%)
De-lever arb: the arbitrageur provides crvUSD, the VirtualPool uses a quadratic formula (not simple proportion) to compute the flash loan needed for a symmetric LP burn. LEVAMM sells LP cheaply (discount), arbitrageur removes LP from Curve pool for more crvUSD than paid → profit. DTV falls back toward 50%.

7Key Formulas

LEVAMM get_x0 — Virtual Reserve Anchor
# cv = oracle value of LP collateral
cv  = p_o × collateral
k   = 4/9  # LEV_RATIO for 2x leverage

x0  = (cv + √(cv² − 4·cv·k·debt)) / (2·k)

# At DTV=50%:  x0 = 3*debt,  x_initial = 2*debt
# At DTV<50%: x0 grows  -> premium (re-lever)
# At DTV>50%: x0 shrinks -> discount (de-lever)
LEVAMM get_dy(1, 0, lp) — LP → crvUSD
x_initial = x0 − debt
y_after   = collateral + lp_amount
x_after   = ⌈x_initial × collateral / y_after⌉

out = (x_initial − x_after) × (1 − fee)

# Hyperbolic invariant:  x_initial × collateral = k
# LEVAMM overpays when x_initial grew (DTV < 50%)
VirtualPool i=1 (Re-Lever, BTC Rises)
# Simple proportion — NO quadratic
flash = in_btc × S / B
#   S = crvUSD in pool,  B = BTC in pool

lp    = supply × in_btc / B
#   symmetric add_liquidity proportional to pool

out   = AMM.get_dy(1, 0, lp) − flash
#   LEVAMM overpays LP when x_initial is inflated
VirtualPool i=0 (De-Lever, BTC Falls)
# Quadratic equation
r0fee = S × (1−fee) / supply
b     = x0−debt + in_crvusd − r0fee×collateral
D     = b² + 4 × r0fee × collateral × in_crvusd

flash = (√D − b) / 2
out   = flash × B / S
#   BTC from symmetric remove_liquidity

8Summary

Re-lever profit (0.001 BTC)
+17.4512 crvUSD
Input: 0.001 BTC = 110.00 crvUSD · +15.865%
LEVAMM marginal premium at T1
+8.76%
DTV dropped to 47.67% · BTC pumped to 110k
DTV restored after arb
47.67% → 47.74%
Moving toward 50% target · LP coll ↑ debt ↑
Flash loan (borrowed & repaid)
110.00 crvUSD
No capital at risk · Same-tx atomicity
LP minted from Curve pool
209.76 LP
Symmetric deposit at pool ratio · 0.105% of coll
De-lever profit (1,000 crvUSD)
+274.28 crvUSD
BTC dropped to 90k · DTV 52.70% · +27.43%
Complete mechanics in one sentence: When BTC rises, the LEVAMM oracle anchor inflates x₀, creating a premium above Curve LP fair value — arbitrageurs exploit this by providing BTC, flash-borrowing crvUSD, minting LP, and selling it to LEVAMM for a profit; the side effect is that LEVAMM gains leverage (DTV rises toward 50%). The symmetric mirror image occurs when BTC falls. Every arbitrage trade nudges the system back toward its 2× leverage target, making arbitrageurs the market’s automatic leverage-rebalancing mechanism.