> For the complete documentation index, see [llms.txt](https://docs.sai.fun/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sai.fun/learn/trading/fees.md).

# Fees

Sai charges some of the lowest trading fees in the perpetual futures market. Taker fees start at a 0.05% base rate, and no fee is taken out for deposits or withdrawals. When factoring in zero gas costs and available discounts, Sai is one of the most competitive exchanges for active futures traders.

## Trading Fee Reference

| Fee Type                | Rate                                                                      | Description                                                                                                                                            |
| ----------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Taker Fee               | 0.05% (Base Rate)                                                         | Charged on the total position size for taker orders.                                                                                                   |
| Taker Fee with Referral | 0.0425%                                                                   | The default and minimum referral code discount on Sai is 15% of trading fees.                                                                          |
| Gas Fees for Trading    | 0 (Free)                                                                  | Always zero on Sai's L1, Nibiru.                                                                                                                       |
| Trigger Fee             | 0.01%                                                                     | Charged only on automated orders (Limit, Stop Loss, Take Profit) to pay for the execution cost.                                                        |
| Deposits & Withdrawals  | 0 (\*)                                                                    | Always zero on Sai's L1, Nibiru. However, gas is required to bridge before depositing.                                                                 |
| Maker Fee               | 0 (Free)                                                                  | No fee is charged for maker orders.                                                                                                                    |
| Rapid-Close Fee         | Up to \~1.15% of position size on most markets, decaying to 0 by \~12 min | Extra closing fee on positions held only briefly; paid to LPs. Some protected markets use a higher peak rate. See [Rapid-Close Fee](#rapid-close-fee). |

Standard trading fees are calculated based on your total **position size** (leverage × collateral), not just your wallet balance.

#### Contents

* [Fees on Sai](#fees-on-sai)
* [Trading Fee Reference](#trading-fee-reference)
* [Key Concepts](#key-concepts)
* [Where Fees are Distributed](#where-fees-are-distributed)
* [Fee Lifecycle](#fee-lifecycle)
  * [1. Opening a Trade](#1-opening-a-trade)
  * [2. Closing a Trade](#2-closing-a-trade)
* [Rapid-Close Fee](#rapid-close-fee)
* [Liquidation Mechanics](#liquidation-mechanics)
  * [Key Difference: Collateral vs. Position](#key-difference-collateral-vs-position)
  * [The Liquidation Penalty](#the-liquidation-penalty)
  * [Priority of Payments (The "Waterfall")](#priority-of-payments-the-waterfall)
  * [Liquidation Example](#liquidation-example)
* [Insufficient Collateral](#insufficient-collateral)

## Key Concepts

* **Base Fees:** Every trade has base percentages for taker, maker, and conditional (trigger) orders.
* **Fee Multipliers:** The base fees are adjusted by two multipliers:
  1. **Tier-based:** High-volume traders earn points, which unlock a lower fee multiplier.
  2. **Referral:** Referred traders receive a discount multiplier.
* **Effective Multiplier:** The lowest of the applicable multipliers is used to calculate the final fee.
* **Liquidation Fees:** These are a fixed percentage of the collateral and are not subject to the multipliers.

## Where Fees are Distributed

* **The Vault (LPs):** Receives 25% of all Closing Fees to support platform stability and reward Liquidity Providers for their risk.
* **The Protocol (Gov):** Receives the remaining 75% of Closing Fees and 100% of Open Fees. A portion of these fees is allocated to a pool for governance stakers.
* **Referrers:** Earn a percentage of the fees generated by their referees from the governance staker portion.
* **Keepers (Bots):** Receive 20% of the Trigger Fee for executing automated orders (Limit, Stop Loss, Take Profit); the remaining 80% goes to the Protocol.

## Fee Lifecycle

### 1. Opening a Trade

When a user opens a trade, the system performs the following steps to calculate and process fees:

1. **Determine Multiplier:** It fetches the trader's fee tier and checks for a referral discount to find the **effective fee multiplier**.
2. **Calculate Fees:** The system calculates the adjusted open and trigger fees by applying the effective multiplier to the base fees.
3. **Deduct and Distribute:** The total fee is deducted from the trader's collateral and distributed. A portion goes to the trigger service provider (if applicable), a cut is allocated to the referrer, and the net amount is added to a pool for governance stakers.

### 2. Closing a Trade

When a user closes a trade, fees are handled differently depending on whether it's a normal closure or a liquidation.

* **Normal Closure:** The system determines the effective multiplier, calculates adjusted close fees, and distributes them.
* **Liquidation:** The fee is a fixed percentage of the trader's collateral, bypassing any fee tier or referral discounts. This fee is then split between the vault and governance stakers.

## Rapid-Close Fee

Sai adds an extra fee when a position is closed very soon after it opens. The fee is largest in the first seconds of a trade and decays smoothly to zero the longer the position is held. It reaches zero after about 12 minutes, so it never touches positions held past that window.

The fee protects Liquidity Providers. Very short holds can capture the brief difference between the on-chain oracle price and the live market price at the Vault's expense; a higher fee on the fastest closes removes that edge while leaving ordinary trading untouched.

### How it is calculated

The fee is a percentage of your **position size** (leverage × collateral). The rate decays exponentially with the time the position is held:

```
fee_rate(hold) = F0 × e^(−hold / τ)
```

* `F0` is the peak rate at the moment of opening (1.15% on the global curve).
* `τ` (tau) sets how fast the rate decays (about 76 seconds).
* The rate is forced to zero once a position is held past 300 blocks, or about 12 minutes.
* The charge is capped at 50% of the collateral being closed.

With the global curve the fee is approximately:

| Hold time              | Fee (of position size) | Example at 10×        | Example at 50×        |
| ---------------------- | ---------------------- | --------------------- | --------------------- |
| 0 seconds              | 1.15%                  | 11.5% of collateral   | capped at 50%         |
| \~1 minute             | \~0.51%                | \~5.1% of collateral  | \~25.7% of collateral |
| \~2 minutes            | \~0.23%                | \~2.3% of collateral  | \~11.5% of collateral |
| \~3 minutes            | \~0.10%                | \~1.0% of collateral  | \~5.1% of collateral  |
| \~5 minutes            | \~0.02%                | \~0.2% of collateral  | \~1.0% of collateral  |
| \~7 minutes            | \~0.004%               | \~0.04% of collateral | \~0.2% of collateral  |
| \~12 minutes or longer | 0                      | 0                     | 0                     |

Because the rate applies to position size, higher leverage makes the same short hold cost a larger share of your collateral. The fee is added to the standard closing fee and is paid entirely to the Vault (LPs). Fee-tier and referral discounts do not reduce it.

### When it applies

The fee applies to voluntary closes and to Take-Profit / Stop-Loss closes, including partial closes and leverage reductions. Liquidations and after-hours risk reductions are exempt.

Most markets share the global curve. A few protected markets carry a higher peak rate `F0` of 2.117%, because a larger per-update price move gives a larger short-hold edge. The protected markets are SUI, ADA, DOGE, HYPE, and ZEC. They use the same decay speed, 300-block window, and 50% collateral cap as the global curve. The live rate for any market is queryable on-chain (see [Verifying Info Onchain](#verifying-info-onchain)).

### What this means for traders

Holding a position for a few minutes or longer makes this fee negligible or zero. Opening and closing within the same minute incurs a meaningful extra fee on close that is largest in the first seconds and falls quickly as the hold grows. In on-chain queries and trade events this fee is labelled the *short-lived-trade penalty*.

## Liquidation Mechanics

Liquidation occurs when your remaining collateral can no longer safely support your open position. At that point, the protocol force-closes the trade to protect the vault from bad debt.

### Key Difference: Collateral vs. Position

Standard trading fees are based on position size. Liquidation fees are different: they are calculated from your **remaining collateral** at the time the position is liquidated. Fee-tier and referral discounts do not apply.

### The Liquidation Penalty

When a position is liquidated, a **10% liquidation penalty** is applied to the remaining collateral. The penalty is split into two equal components:

1. **Closing Component (5% of Collateral):**
   * Compensates the system for closing the position.
   * Split: 20% goes to the Vault; 80% goes to the Protocol.
2. **Trigger Component (5% of Collateral):**
   * Rewards the liquidator or keeper that triggered the liquidation.
   * Split: 20% goes to the Liquidator; 80% goes to the Protocol.

### Priority of Payments (The "Waterfall")

If a user is liquidated and their collateral is nearly empty (insufficient to cover the full fees), the smart contract pays out in a specific priority order to protect the system:

1. **First Priority → The Vault:** The Vault gets its share first to ensure Liquidity Providers are protected.
2. **Second Priority → The Liquidator:** The bot gets its reward next.
3. **Third Priority → The Protocol:** The Government receives whatever is left.

### Liquidation Example

You are liquidated while you have $100 of collateral remaining.

* **Total Penalty Calculation:** $10.00 (10% of $100).
* **Distribution:**
  * $1.00 goes to the Vault (20% of the Closing portion).
  * $1.00 goes to the Liquidator (20% of the Trigger portion).
  * $8.00 goes to the Protocol.
* **Outcome:** The liquidation fee is paid from your remaining collateral. The rest of your collateral is used to settle the forced closure, and your position collateral is zeroed.

## Insufficient Collateral

If a trader's collateral is not sufficient to cover fees and losses, the fees are still accounted for in the internal ledgers (e.g., for governance and referrers) but are not physically transferred from the trader's collateral. The losses are absorbed by the Protocol Vault.

## Verifying Info Onchain

### Claim: Default referral code discount on trading is 15%.

Query the perp contract's raw state for the storage key `referree_base_fee_multiplier`:

```
# Sai Mainnet Perp Smart Contract
PERP='nibi1ntmw2dfvd0qnw5fnwdu9pev2hsnqfdj9ny9n0nzh2a5u8v0scflq930mph'
NODE='https://rpc.nibiru.fi:443'

KEY_HEX="$(printf referree_base_fee_multiplier | xxd -p -c 256)"

nibid query wasm contract-state raw "$PERP" "$KEY_HEX" \
  --node "$NODE" \
  --output json
```

Result:

```js
{"data":"IjAuMTUi"}
```

Then decode the base64 value:

```bash
printf 'IjAuMTUi' | base64 -d
```

Output:

```
"0.15"
```

The storage item is the referral discount amount. Here "0.15" means a 15% discount.

### Claim: The rapid-close fee curve is configured on-chain.

Query the perp contract for the live curve:

```bash
# Sai Mainnet Perp Smart Contract
PERP='nibi1ntmw2dfvd0qnw5fnwdu9pev2hsnqfdj9ny9n0nzh2a5u8v0scflq930mph'
NODE='https://rpc.nibiru.fi:443'

nibid query wasm contract-state smart "$PERP" \
  '{"get_short_lived_penalty_curve":{}}' \
  --node "$NODE" --output json
```

Result:

```json
{"data":{"f0":"0.0115","tau_blocks":"31","max_window_blocks":300,"cap_pct":"0.5"}}
```

`f0` is the global peak rate (`0.0115` = 1.15%), `tau_blocks` the decay constant in blocks, `max_window_blocks` the hold past which the fee is zero (300 blocks ≈ 12 minutes at \~2.44s/block), and `cap_pct` the cap as a fraction of collateral (`0.5` = 50%). To preview the rate for a specific market and hold time, query `get_short_lived_penalty_rate` with a `market_index` and `hold_blocks`.

Protected markets can override the global peak rate. To verify the effective `F0` for a market:

```bash
nibid query wasm contract-state smart "$PERP" \
  '{"get_short_lived_penalty_f0_for_market":{"market_index":43}}' \
  --node "$NODE" --output json
```

Market 43 (HYPE) currently returns:

```json
{"data":"0.02117"}
```
