Skip to main content

Fees and policies

Your YieldBasis yield comes from trading fees, minus the cost of keeping 2× leverage balanced. On pools running an oracle-backed fee policy, dynamic fees help recapture stale-price arbitrage (LVR) from corrective trades, while protocol admin fees fund veYB rewards and crvUSD stability.

Where yield comes from and what it costs​

Every YieldBasis market earns from two fee streams:

  • Curve pool swap fees: Traders swapping BTC or ETH against crvUSD pay dynamic fees that increase the value of the pool's LP tokens (less any Curve DAO pool share).
  • Rebalancing fees: Arbitrageurs trading against YieldBasis to keep leverage at 2× pay a trading fee that stays inside the market and increases share value.

To recenter the Curve pool after price moves, the pool spends part of its accumulated fee profit (the rebalance budget) while protecting a minimum floor of lifetime profit for LPs. If the budget runs down to that floor, recentering waits until new fees or donations refill it.

Chart showing virtual_price rising with trading fees above the dashed profit floor lp_xcp_profit. The shaded gap is the rebalance budget. Rebalancing steps lower virtual_price toward the floor; once virtual_price reaches the floor, further price_scale steps wait until fees or donations rebuild the budget.Chart showing virtual_price rising with trading fees above the dashed profit floor lp_xcp_profit. The shaded gap is the rebalance budget. Rebalancing steps lower virtual_price toward the floor; once virtual_price reaches the floor, further price_scale steps wait until fees or donations rebuild the budget.

To help cover rebalancing costs, YieldBasis also recycles crvUSD borrow interest back into the Curve pool (refueling). Those donations mint no new LP tokens; instead, they release gradually into the pool to fund recentering alongside trading fees.

Under the hood: fee sources, profit floor, and refueling
  • Curve Cryptoswap pool fees: Set by native parameters (mid_fee, out_fee, fee_gamma) or an attached pool policy. Fees lift virtual_price, increasing LEVAMM collateral value (less Curve DAO's share via admin_fee() on the pool).
  • LEVAMM trading fees: Arbitrageurs and swappers trading against LEVAMM (typically via VirtualPool) pay AMM.fee(), which stays inside LEVAMM.
  • Profit floor: reserved_profit_fraction() on the Curve pool sets the minimum share of lifetime profit protected by lp_xcp_profit.
  • Refueling: Calling LT.distribute_borrower_fees() collects accrued crvUSD borrow interest from LEVAMM and donates it to the Curve pool (add_liquidity with donation = True).

How oracle-backed fees mitigate stale-price arbitrage (LVR)​

When BTC or ETH moves on external exchanges, a passive liquidity pool's quote briefly goes stale. Arbitrageurs trade against that stale curve and extract value from LPs—an ongoing adverse-selection cost known as Loss-Versus-Rebalancing (LVR).

On a pool running YBOraclizedPolicy, YieldBasis uses signed Pyth Pro (Pyth Lazer) price reports to adjust the swap fee on corrective trades. The oracle never sets your swap price and cannot move pool reserves—the Curve Twocrypto curve always prices the trade, and the policy only adjusts the fee:

  • Fallback fee by default: Swaps without a fresh price report—or swaps pushing the pool away from or past the reported price—pay fallback_fee.
  • Edge-capture discount for corrective arbitrage: Arbitrageurs who deliver a fresh signed report and trade toward the reported price without overshooting pay base_fee plus a capture share of their pre-fee arbitrage edge (capped at fallback_fee).
  • Time decay: As a report ages toward relax_time, the discount fades smoothly with age/relax_time\sqrt{\text{age} / \text{relax\_time}} back up to fallback_fee.

Regime trade-off: Oracle-backed dynamic fees recapture more arbitrage value in two-sided choppy markets, where small price gaps would otherwise sit below a high flat fee. During strong one-way trends or sudden jumps, discounting corrective swaps can capture less fee revenue per unit of inventory sold than charging fallback_fee on every trade. If reports stop arriving or become stale, the pool safely reverts to fallback_fee.

Oracle fee curve on YBOraclizedPolicy: a corrective swap backed by a fresh PythReportBank report pays the base fee plus capture share of edge, decaying with the square root of report age up to the fallback fee at the relax time. Non-corrective swaps and stale reports pay the fallback fee.Oracle fee curve on YBOraclizedPolicy: a corrective swap backed by a fresh PythReportBank report pays the base fee plus capture share of edge, decaying with the square root of report age up to the fallback fee at the relax time. Non-corrective swaps and stale reports pay the fallback fee.

Illustrative example (using a different illustrative parameter set): Suppose the base fee is 0.50%, the capture share is 67.5%, the fallback fee is 1.75%, and the relax time is 300 seconds. For a $10,000 corrective swap with a 1.00% arbitrage edge:

  • Fresh report (0 s old): pays 0.8375% ($84), keeping most of the edge for LPs.
  • 75 s old (quarter of relax time): fee rises to ~1.29% ($129).
  • Stale report (≥300 s\ge 300\text{ s}): pays the 1.75% fallback fee ($175).

Policies never change where fees go: swap fees still accrue to Curve LP holders (primarily YieldBasis LPs), less any Curve pool admin fee.

Under the hood: pool policy rules, governance, and failure modes

Call POLICY() on a Curve Twocrypto v3.0.0 pool (or check Contract addresses) to see which policy a market runs (0x0 means no policy is attached):

Policy contractSwap fee behaviorprice_scale targetLT deviation deposit check
YBOraclizedPolicyDynamic discount between base fee and fallback fee for corrective swaps backed by a fresh PythReportBank reportFast and slow EMAs driven by signed Pyth Pro (Pyth Lazer) USD reports (falling back to prior spot price after report lifetime)Active while policy is not killed (ratio_tolerance(), capped at 10 bp)
YBTwocryptoPolicyUses the Curve pool's native fee curve unchangedDriven only by the pool's own trade pricesNot enforced

Four conditions for a swap discount on YBOraclizedPolicy:

  1. The newest PythReportBank report for the feed is younger than the policy's relax time and inside its configured price bounds.
  2. The crvUSD/USD aggregator rate lies between $0.50 and $2.00.
  3. The swap is corrective—moving the pool price toward the converted report price without overshooting it.
  4. The swap has positive edge (gain at the report price before fees).

Qualifying swaps pay the base fee plus a capture share of edge above the base fee, capped at the fallback fee, decaying with age/relax_time\sqrt{\text{age} / \text{relax\_time}} toward the fallback fee. Swaps while pool amplification A is ramping generally pay the fallback fee. Call config() on the policy for live parameters.

Deposit and withdrawal fees on YBOraclizedPolicy: Adding liquidity or executing an imbalanced withdrawal pays half the fallback fee on the imbalanced portion (balanced removals pay no imbalance fee). During a donation protection window, deposits can incur a penalty of up to half the fee rate on the full deposit. LT.preview_deposit and LT.preview_withdraw include these fees.

Governance and failure modes on YBOraclizedPolicy:

  • Policy attachment: After one-time initialize(), only Curve DAO (set_policy_contract) can attach, replace, or remove a pool's policy.
  • Parameter tuning and verifier: YieldBasis DAO (YB DAO) owns each YBOraclizedPolicy (updating parameters within hardcoded bounds) and owns PythReportBank (including set_verifier). Price authenticity therefore relies on YB DAO.
  • Kill switch: Either YB DAO or the Curve Emergency DAO can kill a policy immediately, restoring the pool's native fee curve and price_scale target and disabling the LT deviation check.
  • Reverting policy callback: If a policy reverts, swaps, deposits, and standard withdrawals revert. Balanced removals ignore a failed policy callback when at least 500,000 gas remains before the callback, keeping LT.emergency_withdraw operational.
  • crvUSD depeg: Swap-fee conversion uses the crvUSD/USD aggregator (disabling discounts outside $0.50–$2.00), while the price_scale driver treats 1 crvUSD as $1. A sustained crvUSD depeg skews the price_scale target by roughly the depeg size.

How protocol fees are split​

Whenever a market realizes net gains, YieldBasis checks whether staked shares sit below their watermark. If they do, protocol admin fees pause until staked shares catch up. Otherwise, gains split between unstaked LPs and protocol admin fees, which route to veYB lockers and the crvUSD Net Pressure reserve:

Flow diagram showing how Curve pool trading fees are allocated: 100% of swap fees split between unstaked LPs (whose share auto-compounds in yb-LP) and the dynamic Protocol Admin Fee (which scales with the share of yb-LP staked), which FeeSplitter routes to veYB lockers via FeeDistributor and to the Net Pressure pool via MerklPIDDriver.Flow diagram showing how Curve pool trading fees are allocated: 100% of swap fees split between unstaked LPs (whose share auto-compounds in yb-LP) and the dynamic Protocol Admin Fee (which scales with the share of yb-LP staked), which FeeSplitter routes to veYB lockers via FeeDistributor and to the Net Pressure pool via MerklPIDDriver.
Under the hood: FeeSplitter distribution

Calling LT.withdraw_admin_fees() mints accrued admin fees as yb-LP shares to Factory.fee_receiver() (FeeSplitter). FeeSplitter.trigger() then splits each market's yb-LP balance:

  • FeeSplitter.split_fraction() routes to FeeSplitter.pid() (MerklPIDDriver) to fund the crvUSD Net Pressure reserve.
  • 1 - FeeSplitter.split_fraction() forwards to FeeSplitter.fee_distributor() (FeeDistributor), streaming yb-LP to veYB holders over 4 weeks (epochs every Thursday at 00:00 UTC).

Net Pressure and the PID loop​

During a sharp BTC or ETH sell-off, traders remove crvUSD from the Curve pool, leaving the market with more crvUSD debt than the crvUSD sitting inside its Curve LP collateral. That gap is called Net Pressure.

Because governance gauge votes update over days while market sell-offs move in minutes, YieldBasis runs an automated feedback loop (a PID loop) funded by a share of protocol admin fees. Whenever Net Pressure rises, the loop automatically boosts crvUSD rewards in a Curve stableswap sink pool to attract crvUSD liquidity and support the peg.

Four-step circular Net Pressure feedback loop: (1) positive Net Pressure signals high crvUSD debt relative to Curve pool crvUSD, (2) the PID controller raises the target APR, (3) admin fees fund Merkl incentives to attract crvUSD into the sink pool, and (4) deeper sink-pool liquidity restores peg balance and relaxes the target APR.Four-step circular Net Pressure feedback loop: (1) positive Net Pressure signals high crvUSD debt relative to Curve pool crvUSD, (2) the PID controller raises the target APR, (3) admin fees fund Merkl incentives to attract crvUSD into the sink pool, and (4) deeper sink-pool liquidity restores peg balance and relaxes the target APR.
Under the hood: YBNetPressure and MerklPIDDriver

Net Pressure=AMM crvUSD Debt−crvUSD inside AMM’s Curve LP\text{Net Pressure} = \text{AMM crvUSD Debt} - \text{crvUSD inside AMM's Curve LP}

  • Balanced (≈0\approx 0): Unwinding Curve LP collateral covers the AMM's crvUSD debt.
  • Positive (buy pressure): Unwinding the LP would require buying crvUSD on the open market.
  • Negative (sell pressure): The LP holds more crvUSD than the AMM owes.

YBNetPressure computes this gap from manipulation-resistant AMM invariants (x0 and constant product kk) and the pool's price_oracle EMA rather than manipulable spot reserves.

  1. MerklPIDDriver reads normalized Net Pressure and total AMM equity (half_tvl) from YBNetPressure across YB DAO-selected markets.
  2. Merkl supplies live crvUSD liquidity in the configured Curve stableswap sink pool (MerklPIDDriver.sink_pool()).
  3. MerklPIDDriver.preview_target_apr() combines feedforward, proportional, integral, and rising-pressure derivative terms into an offer multiple (floored at 1×), multiplying (offer - 1) by the benchmark savings rate from MarketRateGetter.

MerklPIDDriver is stateless onchain; Merkl runs the offchain loop, persists PID state, and distributes a Pull-on-Claim reward wrapper (MerklPIDDriver.reward_wrapper()). When MerklPIDDriver.trigger() runs (permissionlessly, including via FeeSplitter.trigger()), it withdraws the underlying asset from its received yb-LP shares with oracle-bounded slippage protection, swaps that asset to crvUSD in the market's Curve pool, and stores the crvUSD in MerklPIDDriver.reserve(). Claiming on Merkl pulls crvUSD 1:1 from that reserve, capping total payouts at available funds.

Next steps​