

Funding rate versus premium, clamped at 100 percent per day.
The rate
Funding compares the mark price (an EMA, never spot: fed by the internal AMM on internal-venue markets and by the oracle-pushedpush_mark on external-venue markets; see AMM) to the index TWAP:
funding_k_bps is the sensitivity: at 10000 the daily rate equals the premium one for one (before the clamp). The clamp is the hard bound; no matter how large the premium prints, funding cannot move faster than max_funding_bps_per_day.
How it is applied
Anyone can callaccrue_funding (a permissionless crank), rate-limited by min_crank_interval_secs and gated on index freshness (a market past max_index_age_secs without a push returns IndexStale; funding must never accrue against a price the oracle stopped standing behind, see the staleness guard). The crank:
- Refreshes the mark: from the current AMM reserves on internal markets; on external markets it instead requires a pushed mark to exist (
NoMark) and to be fresh withinmax_index_age_secs(IndexStale). - Computes the clamped rate above.
- Applies it, pro-rated by elapsed time, to the market’s global
funding_index(a fixed-point multiplier,FUNDING_ONE = 1e12).
funding_index reprices all debt at once. See Shorts for the exact scaling.
Direction
Together with reserve draw/repay arbitrage (drawing at the index is profitable when the mark is rich; repaying at the index is profitable when the mark is cheap), this pulls the mark toward the index from both sides.
The tether is soft. Funding drifts the price toward the index; it does not pin it there. Expect a persistent basis of a few percent in normal conditions, wider in stressed ones.

