Funding
A quadratic daily Funding curve based on lending utilization, gross-notional accrual, and Q128 time accumulation, with exact rounding examples.
Funding is the USDC fee paid by a Short position for continuously occupying lending capacity. It is neither perpetual-futures funding transferred between longs and shorts nor borrowing interest calculated from the live Token price. In this version, Short positions pay it into the separate fundingNative revenue ledger.
The mechanism has two layers: Token lending utilization determines the rate; gross USDC notional shares determine each position's payment.
The chart uses FULL parameters. The daily-rate curve is not an investment return.
1. Parameters and Units
| Symbol / parameter | Value and unit | Purpose |
|---|---|---|
| 199,861,071 Token | FULL initial lending principal | |
| Token, 18 decimals | Confirmed unrecovered lending principal | |
| Token, 18 decimals | Total borrowing by all currently active positions | |
bps, 10,000 = 100% | Inventory utilization quantized downward | |
| Start / end | 1,000 / 9,000 bps | 10% / 90% utilization |
| 99,990 ppm / day | Curve increment coefficient | |
| 10 ppm / day | Minimum daily fee rate | |
| Smallest USDC units, 18 decimals | Position shortShares, measured by gross notional | |
| Funding fixed-point index precision |
1,000,000 ppm = 100%; a day is 86,400 seconds. USDC parameters expressed with ether simply use Solidity's
2. Utilization and the Quadratic Curve
First exclude confirmed bad debt:
If effective principal is zero, the code directly sets
For
The daily rate
The current implementation is a quadratic curve with a squared term, not a cubic curve. The daily rate is 0.001% below 10% utilization and reaches 10% / day at 90%. Funding costs rise substantially at high utilization; the minimum rate must not be presented as a fixed charge.
| Utilization | Integer daily rate | Daily percentage | Approximate one-day fee on 1,000 USDC of shares | |
|---|---|---|---|---|
| ≤10% | Not applicable | 10 ppm | 0.001% | 0.010 USDC |
| 30% | 2,500 | 6,259 ppm | 0.6259% | 6.259 USDC |
| 50% | 5,000 | 25,007 ppm | 2.5007% | 25.007 USDC |
| 70% | 7,500 | 56,254 ppm | 5.6254% | 56.254 USDC |
| ≥90% | Not applicable | 100,000 ppm | 10% | 100.000 USDC |
The fees in the table are decimal approximations for readability; actual on-chain amounts also go through the Q128 integer calculations below.
3. Accrual by Second and Allocation by Share
Let
Position
Both steps round down. Across multiple checkpoints, calculate each
Why Is Past Funding Not Revalued at the Instantaneous Market Price?
- The daily rate comes from the Token inventory ledger and does not directly depend on the Pair price at that moment.
- Position shares come from gross notional,not borrowed Token quantity × spot price at the checkpoint.
- Opening, increasing, partial closing, and liquidation update the index before changing borrowing, fixing the past interval at its previous utilization.
- Bad-debt recovery is permitted only with no active Token borrowing, preventing the lower utilization after recovery from being applied retroactively to earlier intervals.
Market trades may still change the Token quantities required by future new positions and thus indirectly affect future utilization; not charging at the instantaneous market price does not mean that future fees are entirely unaffected by market activity.
4. How Settlement Deducts Fees
Let current position funds be
The paid portion moves from marginNative into fundingNative without reducing the historical collateral ledger value collateralNative ; amounts due but unpaid do not become realized protocol revenue merely by being owed.
| Operation | Funding treatment |
|---|---|
| New position | Update the global index; new shares accrue from the current snapshot and are not charged for earlier intervals |
| Increase position | Settle the old interval on old shares first; then add new shares and charge the combined shares thereafter |
| Add collateral | Add funds first, then settle fees on all shares; new funds may cover old unpaid fees |
| Full close | Settle all shares first, then perform the respective safety checks |
| Close partially | Settle only closing shares; remaining shares retain their old snapshot and corresponding historical unpaid fees |
| Liquidate | Settle Funding first; if it cannot be fully paid, enter the dedicated Funding-insolvency branch |
Except during liquidation, an operation reverts if any Funding required to be settled by that operation remains unpaid. After a partial close, historical Funding on remaining shares may remain pending. Reducing shares through partial closing cannot erase historical Funding.
5. Exact FULL-Parameter Example
Continue the Short opening example: 18,390,419.136168399731870069 Token borrowed, effective principal of 199,861,071 Token, with no other positions or bad debt.
Utilization quantized into bps is 9.20%, below 10%, so
This is 0.009999999999999999 USDC, one smallest 18-decimal unit below the ideal decimal value 0.01 USDC , because the index and final multiplication each round down.
If other positions instead keep utilization at 50%, the exact one-day fee for the same 1,000 USDC gross-notional shares is 25.006999999999999999 USDC. This is a scenario on the same FULL curve, not test parameters with reduced initial inventory.
Separate Intervals before and after Increasing a Position
If a position holds
Position operation limits
Only collateral additions are supported; no separate withdrawal entry point exists for live positions. Partial closes also return no funds to the wallet.
If the latest successful opening or position increase occurs in block N, a partial or full close is possible no earlier than block N+1 and must still pass all other execution checks.