Skip to main content

Arbitrage & MEV

How arbitrageurs earn the rebalance fee and how that keeps the protocol working.

The arbitrage

LEVAMM targets a balanced state in which debt equals half of collateral value, evaluated at the oracle price pop_o. Cryptoswap, the underlying constant-product pool, tracks live market price.

When LEVAMM's quote diverges from Cryptoswap's spot price, an arbitrageur trades through the VirtualPool to close the gap. The trade pays LEVAMM's 0.7% fee and earns the spread between the two prices. Each profitable arb also pushes the position back toward the 50% debt ratio.

The path — VirtualPool

Direct swaps between the volatile asset and crvUSD route through the VirtualPool contract, which composes a flash loan, a Cryptoswap deposit or withdraw, and a LEVAMM swap into a single atomic transaction.

Asset to crvUSD

  1. Flash borrow crvUSD (covers the LP purchase).
  2. Balanced deposit into Cryptoswap → LP tokens.
  3. Sell LP tokens to LEVAMM.
  4. Repay flash loan from stablecoin output.

crvUSD to asset

  1. Flash borrow additional crvUSD.
  2. Buy LP tokens from LEVAMM.
  3. Symmetric withdraw from Cryptoswap → asset + crvUSD.
  4. Repay flash loan.

The flash-loan amount for the stable-to-asset leg solves a quadratic. The canonical form is Math Primer Eq (3.15).

MEV characteristics

Arbitrage executes atomically. A single transaction either clears the spread or reverts. Upper size bounds come from crvUSD flash-loan capacity and LEVAMM swap limits.

Valuation inside LEVAMM uses the oracle price rather than the Cryptoswap spot price. A sandwich attacker who pushes the pool within one block cannot move the EMA-smoothed (exponential moving average, a rolling price that weights recent observations more and averages across many prior blocks) oracle (see Oracle Design) within the same block, so the valuation the arbitrageur is paid against does not move with the attack.

The fee charged to arbitrageurs (approximately 0.7 percent) sets the minimum spread at which extraction becomes profitable. Below that threshold, the gap persists until volatility or a block delay widens it; above it, searchers compete on latency and priority.