Fee Types
| Fee | Formula | When Collected |
|---|---|---|
| Trading Fee | notional * snapshotTradingFeeBps / 10,000 | Open, increase, settlement, close, reduce |
| Liquidation Penalty | notional * snapshotLiquidationPenaltyBps / 10,000 | Liquidation only (added on top of trading fee) |
| Oracle Fee | Flat snapshotOracleFee per price read | Every forward price lookup |
All fee rates are snapshotted at position open time. If the admin changes fee configuration after a position is opened, the change only affects newly opened positions. Existing positions retain the rates they were opened with, ensuring traders know their costs upfront.
Distribution Split
Collected fees are split between two destinations usingFeeLib.distributeFee():
| Destination | Default Share | Description |
|---|---|---|
| Treasury | 30% (3,000 bps) | Protocol revenue, used for operations and development |
| Pool | 70% (7,000 bps) | LP compensation, distributed via vault share price increase |
Fee Capping
Fees are always capped at the margin available after PnL settlement. The protocol never reverts due to insufficient funds for fees — it collects what is available.After Profit
After Profit
The full margin at risk is available for fee collection:
After Loss
After Loss
Loss is deducted from margin first, then fees are taken from the remainder:
Zero PnL
Zero PnL
The full margin at risk is available for fee collection:
If a position’s margin is insufficient to cover the full fee after PnL settlement, the protocol collects a partial fee rather than reverting. This ensures settlements and liquidations always complete, even in bad debt scenarios.
Fee Collection Methods
Fees are collected through different mechanisms depending on the context:| Context | Collection Method | Source |
|---|---|---|
| Position open | collectFee | Free collateral (available balance) |
| Position increase | collectFee | Free collateral (available balance) |
| Settlement (maturity, liquidation, early close, reduce) | Deducted in _settlePosition | Locked margin (imLocked) |
| Oracle fee | collectFeeFromCollateral | Total collateral (can draw from locked margin) |
The oracle fee uses
collectFeeFromCollateral, which can draw from the account’s total collateral balance including locked margin. This is necessary because oracle fees are incurred during price lookups that may happen before any position-specific margin is available.Example Fee Calculation
Consider a trader opening a 10,000 USDC notional LONG position with the following snapshotted parameters:| Parameter | Value |
|---|---|
| Trading Fee | 5 bps (0.05%) |
| Oracle Fee | 0.10 USDC (flat) |
| Treasury Share | 30% (3,000 bps) |
| Pool Share | 70% (7,000 bps) |
- Trading fee:
10,000 * 5 / 10,000 = 5 USDC - Oracle fee:
0.10 USDC - Total:
5.10 USDC
- Treasury receives:
5 * 0.30 = 1.50 USDC(trading fee share) + oracle fee handling - Pool receives:
5 * 0.70 = 3.50 USDC(trading fee share), increasing vault share price
- Another
5 USDCtrading fee is collected from locked margin - Split the same way:
1.50 USDCto treasury,3.50 USDCto pool