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.
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 liftvirtual_price, increasingLEVAMMcollateral value (less Curve DAO's share viaadmin_fee()on the pool). LEVAMMtrading fees: Arbitrageurs and swappers trading againstLEVAMM(typically viaVirtualPool) payAMM.fee(), which stays insideLEVAMM.- Profit floor:
reserved_profit_fraction()on the Curve pool sets the minimum share of lifetime profit protected bylp_xcp_profit. - Refueling: Calling
LT.distribute_borrower_fees()collects accrued crvUSD borrow interest fromLEVAMMand donates it to the Curve pool (add_liquiditywithdonation = 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_feeplus acaptureshare of their pre-fee arbitrage edge (capped atfallback_fee). - Time decay: As a report ages toward
relax_time, the discount fades smoothly with back up tofallback_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.
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 (): 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 contract | Swap fee behavior | price_scale target | LT deviation deposit check |
|---|---|---|---|
YBOraclizedPolicy | Dynamic discount between base fee and fallback fee for corrective swaps backed by a fresh PythReportBank report | Fast 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) |
YBTwocryptoPolicy | Uses the Curve pool's native fee curve unchanged | Driven only by the pool's own trade prices | Not enforced |
Four conditions for a swap discount on YBOraclizedPolicy:
- The newest
PythReportBankreport for the feed is younger than the policy's relax time and inside its configured price bounds. - The crvUSD/USD aggregator rate lies between $0.50 and $2.00.
- The swap is corrective—moving the pool price toward the converted report price without overshooting it.
- 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 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 ownsPythReportBank(includingset_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_scaletarget and disabling theLT deviationcheck. - Reverting policy callback: If a policy reverts, swaps, deposits, and standard withdrawals revert. Balanced removals ignore a failed policy callback when at least
500,000gas remains before the callback, keepingLT.emergency_withdrawoperational. - crvUSD depeg: Swap-fee conversion uses the crvUSD/USD aggregator (disabling discounts outside $0.50–$2.00), while the
price_scaledriver treats 1 crvUSD as $1. A sustained crvUSD depeg skews theprice_scaletarget 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:
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 toFeeSplitter.pid()(MerklPIDDriver) to fund the crvUSD Net Pressure reserve.1 - FeeSplitter.split_fraction()forwards toFeeSplitter.fee_distributor()(FeeDistributor), streamingyb-LPto 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.
Under the hood: YBNetPressure and MerklPIDDriver
- Balanced (): 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 ) and the pool's price_oracle EMA rather than manipulable spot reserves.
MerklPIDDriverreads normalized Net Pressure and total AMM equity (half_tvl) fromYBNetPressureacross YB DAO-selected markets.- Merkl supplies live crvUSD liquidity in the configured Curve stableswap sink pool (
MerklPIDDriver.sink_pool()). MerklPIDDriver.preview_target_apr()combines feedforward, proportional, integral, and rising-pressure derivative terms into an offer multiple (floored at1×), multiplying(offer - 1)by the benchmark savings rate fromMarketRateGetter.
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
- Positions and yield: explore the interactive admin-fee curve and below-the-watermark rules.
- TRD and pricing: see how rebalance budget limits and policy targets shape TRD.
- Pool policy and report bank: inspect hardcoded policy bounds, hook signatures, and
PythReportBankverification. - Arbitrage and oracle reports: bundle signed Pyth Pro (Pyth Lazer) reports with Curve swaps.
- Contract addresses: look up deployed pools, policies,
FeeSplitter, andMerklPIDDriver.