Vault
1. Overview
The vault is the passive market maker for the perpetual futures exchange. It continuously quotes bid/ask orders around the oracle price on every pair, earning the spread.
Liquidity providers (LPs) deposit settlement currency into the vault and receive vault shares credited to their account.
2. Liquidity provision
Adding liquidity follows an ERC-4626 virtual shares pattern to prevent the first depositor inflation attack.
Constants
| Name | Value |
|---|---|
| Virtual shares | 1,000,000 |
| Virtual assets | $1 |
Share minting
The LP specifies a USD margin amount to transfer from their trading margin to the vault.
Floor rounding protects the vault from rounding exploitation. A minimum-shares parameter lets depositors revert if slippage is too high.
First depositor protection
The virtual terms dominate when real supply and equity are small. An attacker cannot inflate the share price to steal from subsequent depositors because the initial share price is effectively per share.
3. Liquidity withdrawal
The LP specifies how many vault shares to burn. The USD value to release is computed:
The fund is not released immediately. A cooldown is initiated, with the ending time computed as:
Once is reached, the contract credits the released USD value back to the LP’s trading margin.
4. Vault equity
The vault has its own user state (positions acquired from market-making fills). Its equity follows the same formula as any user:
where is the vault’s internal USD margin (updated in-place during settlement), and the sums run over all of the vault’s open positions.
If is non-positive the vault is in catastrophic loss and both deposits and withdrawals are disabled.
5. Market making policy
The vault uses its margin to market make in the order book. Each block, after the oracle update, the vault cancels all existing quotes and recomputes bid/ask orders for every pair.
The strategy uses inventory skew to reduce the vault’s exposure to directional price movements. When the vault accumulates a position in one direction, it tilts both order sizes and spreads to encourage trades that unwind that position.
Margin allocation
Total vault available margin is split across pairs by weight:
where and is the sum of initial margin across all vault positions (see Margin §8).
Skew ratio
For each pair, compute a skew ratio from the vault’s current position:
where is the vault’s signed position (positive = long, negative = short) and is the position size at which skew saturates.
At zero position, and quoting is symmetric. At maximum long, . At maximum short, .
Quote size
Each side receives half the allocated margin, capped by a per-pair maximum, then tilted by the skew:
where is the initial margin ratio and controls skew intensity.
When the vault is long (), bid size decreases and ask size increases — the vault offers more on the sell side to unwind. Total quoted size () is preserved.
Bid price
Snap down to the nearest tick:
Book-crossing prevention: if , clamp to .
Skip if or notional is below the minimum order size.
When the vault is long, the bid spread widens (less likely to accumulate more).
Ask price
Snap up to the nearest tick (ceiling):
Book-crossing prevention: if , clamp to .
Skip if notional is below the minimum order size.
When the vault is long, the ask spread tightens (more attractive to takers who buy from the vault).
Combined effect
When the vault is long, all four levers push toward unwinding:
- Bid size decreases (less buying)
- Ask size increases (more selling)
- Bid spread widens (buys less likely to fill)
- Ask spread tightens (sells more likely to fill)
The mirror applies when short.
Per-pair parameters
| Parameter | Role |
|---|---|
initial_margin_ratio | Used to compute margin-constrained size |
min_order_size | Minimum notional to place an order |
tick_size | Price granularity for snapping |
vault_half_spread | Base half bid-ask spread around oracle price |
vault_liquidity_weight | Weight for margin allocation across pairs |
vault_max_quote_size | Maximum base size per side |
vault_max_skew_size | Position size at which skew saturates |
vault_size_skew_factor | Size skew intensity () |
vault_spread_skew_factor | Spread skew intensity () |
If any of vault_half_spread, vault_max_quote_size, vault_liquidity_weight, tick_size, or the allocated margin is zero, the vault skips quoting for that pair.
Choosing parameters
vault_max_skew_size — the position size at which skew reaches its maximum. A natural starting point is vault_max_quote_size (the existing per-side cap). This means: once the vault has accumulated one full order’s worth of directional exposure, skew is fully engaged. For gentler unwinding, use 2x vault_max_quote_size.
vault_size_skew_factor — how aggressively to tilt order sizes. Start with 0.5: at maximum skew, the heavier side quotes 1.5x and the lighter side 0.5x. A value of 1.0 fully shuts off quoting on one side at max position, which may be too aggressive for a vault that should always provide some liquidity. Range 0.5 to 0.8 is recommended.
vault_spread_skew_factor — how aggressively to tilt spreads. Start with 0.3: at maximum skew, the tightened side has 70% of normal spread and the widened side has 130%. Keep this below vault_size_skew_factor — size adjustment is the primary lever, spread adjustment is the fine-tuning. Range 0.3 to 0.5 is recommended. Values above 1.0 are permitted and cause the tightened side to cross the oracle price at maximum skew (an aggressive-unwind posture, useful for quickly deleveraging a large directional position); the invariant bid < ask still holds since ask - bid = 2 × oracle × vault_half_spread. The effective upper bound is governed by the cross-field invariant vault_half_spread × (1 + vault_spread_skew_factor) < 1, which ensures the bid stays positive at max skew.
General tuning principle: start conservative (size 0.5, spread 0.3), observe PnL and position behavior, increase if the vault still accumulates too much directional exposure.