Appearance
Perps Calls
Calls on the perps module, submitted Borsh-encoded to the single Submit Transaction endpoint. Fields are listed in Borsh serialization order; see Encoding and Data Structures & Constants.
Create Perp Orderbook
perps.create_perp_orderbook
Create a new perpetual orderbook
Protocol / admin operation.
| Field | Type | Required | Description |
|---|---|---|---|
base_token_name | TokenName | yes | the base token name/symbol |
base_decimals | uint8 | yes | |
tick_size | uint64 | yes | tick size in quote smallest units |
default_maker_fee_100th_bps | SignedBPS100thFee | yes | default maker fee in 100th bps (negative = rebate) |
default_taker_fee_100th_bps | SignedBPS100thFee | yes | default taker fee in 100th bps (negative = rebate) |
margin_tiers | Vec<(uint64, uint8)> | yes | position size-based margin requirements |
max_market_order_value | uint64 | yes | maximum single market order notional value |
max_limit_order_value | uint64 | yes | maximum single limit order notional value |
impact_quantity | uint64 | yes | quantity to use for impact price calculation |
oracle_id | OracleId | yes | Oracle identifier for market |
max_mark_deviation_bps | uint16 | yes | Maximum mark price deviation from oracle in basis points (e.g., 500 = 5%). 0 = disabled. |
price_band_bps | uint16 | yes | Execution price-band half-width in bps: a fill must be within oracle ± this percentage (e.g. 500 = ±5%). 0 = disabled. (Distinct from the placement band.) |
Deposit Margin
perps.deposit_margin
Deposit margin into a subaccount
| Field | Type | Required | Description |
|---|---|---|---|
subaccount_id | SubAccountId | yes | subaccount to deposit into |
amount | uint64 | yes | amount in quote atoms |
address | Option<EthereumAddress> | no | Optional address to credit. Defaults to the transaction sender. |
Withdraw Margin
perps.withdraw_margin
Withdraw margin from a subaccount
| Field | Type | Required | Description |
|---|---|---|---|
owner | Option<EthereumAddress> | no | Optional owner when signed by a delegate |
subaccount_id | SubAccountId | yes | subaccount to withdraw from |
amount | uint64 | yes | amount in quote atoms |
Subaccount Transfer
perps.subaccount_transfer
Transfer margin between subaccounts of the same user
| Field | Type | Required | Description |
|---|---|---|---|
owner | Option<EthereumAddress> | no | Optional owner when signed by a delegate |
from_subaccount_id | SubAccountId | yes | source subaccount id |
to_subaccount_id | SubAccountId | yes | destination subaccount id |
amount | uint64 | yes | amount to transfer in quote atoms |
Place Order
perps.place_order
Place an order on a perp market
| Field | Type | Required | Description |
|---|---|---|---|
owner | Option<EthereumAddress> | no | Optional owner when signed by a delegate |
vault_id | Option<uint64> | no | Optional vault ID — when set, sender must be vault manager/owner and the order routes to the vault's account |
subaccount_id | Option<SubAccountId> | no | The subaccount to place order from (defaults to 0) |
market_id | MarketId | yes | market to place order on |
side | Side | yes | order side (Bid = Long, Ask = Short) |
order_type | OrderType | yes | order type (Market, Limit, etc.) |
order_fill_method | TimeInForce | yes | fill method |
quantity | uint64 | yes | order quantity |
price | Option<uint64> | no | order price (ignored for market orders and pegged orders) For stop orders, this is the limit price at which the order will execute. |
client_order_id | ClientOrderId | yes | client order id for tracking |
offset | Option<uint8> | no | The optional price offset of the order for oracle peg orders |
max_price | Option<uint64> | no | Maximum price for pegged orders (price cap for buy, floor for sell) |
trigger_price | Option<uint64> | no | The optional trigger price of the order for stop orders |
parent | Option<ClientOrderId> | no | The optional parent order id of the order for OCO orders |
reduce_only | Option<bool> | no | If true, this order can only reduce an existing position, not increase it. Reduce-only orders placed by accounts in Warning/Restrict tier are allowed. During matching, reduce-only maker orders that would increase position are cancelled. |
Cancel Order
perps.cancel_order
Cancel an order by client order ID
| Field | Type | Required | Description |
|---|---|---|---|
owner | Option<EthereumAddress> | no | Optional owner when signed by a delegate |
vault_id | Option<uint64> | no | Optional vault ID — when set, sender must be vault manager/owner |
client_order_id | ClientOrderId | yes | The client order ID of the order to cancel |
subaccount_id | Option<SubAccountId> | no | The subaccount the order belongs to (defaults to 0) |
Cancel All Orders
perps.cancel_all_orders
Cancel all orders for a subaccount
| Field | Type | Required | Description |
|---|---|---|---|
owner | Option<EthereumAddress> | no | Optional owner when signed by a delegate |
vault_id | Option<uint64> | no | Optional vault ID — when set, sender must be vault manager/owner |
subaccount_id | Option<SubAccountId> | no | The subaccount to cancel all orders for (defaults to 0) |
Place Oco Order
perps.place_oco_order
Place an OCO (one-cancels-other) order pair (e.g. TP + SL bracket)
| Field | Type | Required | Description |
|---|---|---|---|
owner | Option<EthereumAddress> | no | Optional owner when signed by a delegate |
vault_id | Option<uint64> | no | Optional vault ID — when set, sender must be vault manager/owner |
subaccount_id | Option<SubAccountId> | no | The subaccount to place orders from (defaults to 0) |
order_1 | PlaceOrderParams | yes | The first order (e.g. take-profit) |
order_2 | PlaceOrderParams | yes | The second order (e.g. stop-loss) |
reduce_only | Option<bool> | no | If true, both legs can only reduce an existing position |
Modify Order
perps.modify_order
Modify an order. Cancels and replaces with a new order keeping the same client order id.
| Field | Type | Required | Description |
|---|---|---|---|
owner | Option<EthereumAddress> | no | Optional owner when signed by a delegate |
vault_id | Option<uint64> | no | Optional vault ID — when set, sender must be vault manager/owner |
subaccount_id | Option<SubAccountId> | no | The subaccount the order belongs to (defaults to 0) |
market_id | MarketId | yes | The new market id |
side | Side | yes | The new side |
order_type | OrderType | yes | The new order type |
order_fill_method | TimeInForce | yes | The new fill method |
price | Option<uint64> | no | The new price (None for market/pegged orders) |
quantity | uint64 | yes | The new quantity |
client_order_id | ClientOrderId | yes | The client order id (must match existing order) |
offset | Option<uint8> | no | The optional price offset for oracle peg orders |
max_price | Option<uint64> | no | Maximum price for pegged orders |
trigger_price | Option<uint64> | no | The optional trigger price for stop orders |
parent | Option<ClientOrderId> | no | The optional parent order id for OCO orders |
reduce_only | Option<bool> | no | If true, this order can only reduce an existing position |
Place Multiple Orders
perps.place_multiple_orders
Place multiple orders in a single transaction
| Field | Type | Required | Description |
|---|---|---|---|
owner | Option<EthereumAddress> | no | Optional owner when signed by a delegate |
vault_id | Option<uint64> | no | Optional vault ID — when set, sender must be vault manager/owner |
subaccount_id | Option<SubAccountId> | no | The subaccount to place orders from (defaults to 0) |
orders | SafeVec_512_of_PlaceOrderParams | yes | The orders to place |
Cancel Pegged Order If Beyond Max Price
perps.cancel_pegged_order_if_beyond_max_price
Cancel a pegged order if its effective price exceeds its max price
| Field | Type | Required | Description |
|---|---|---|---|
owner | Option<EthereumAddress> | no | Optional owner when signed by a delegate |
vault_id | Option<uint64> | no | Optional vault ID — when set, sender must be vault manager/owner |
subaccount_id | Option<SubAccountId> | no | The subaccount the order belongs to (defaults to 0) |
client_order_id | ClientOrderId | yes | The client order id of the pegged order |
Cancel Restricted Orders
perps.cancel_restricted_orders
Cancel all orders for an account in Restrict health tier (permissionless keeper)
Anyone can call this for any account that is at or below Restrict tier. BLP accounts are exempt.
Protocol / admin operation.
| Field | Type | Required | Description |
|---|---|---|---|
user | EthereumAddress | yes | The user address whose orders should be cancelled |
subaccount_id | SubAccountId | yes | The subaccount to cancel orders for |
Change Leverage
perps.change_leverage
Change leverage for a market
| Field | Type | Required | Description |
|---|---|---|---|
owner | Option<EthereumAddress> | no | Optional owner when signed by a delegate |
market_id | MarketId | yes | market to change leverage for |
vault_id | Option<uint64> | no | Optional vault ID — when set, sender must be vault manager/owner |
subaccount_id | SubAccountId | yes | subaccount to change leverage for |
new_leverage | uint8 | yes | new leverage value |
Change Margin Mode
perps.change_margin_mode
Change margin mode for a market (cross <-> isolated)
| Field | Type | Required | Description |
|---|---|---|---|
owner | Option<EthereumAddress> | no | Optional owner when signed by a delegate |
market_id | MarketId | yes | market to change margin mode for |
vault_id | Option<uint64> | no | Optional vault ID — when set, sender must be vault manager/owner |
subaccount_id | SubAccountId | yes | subaccount to change margin mode for |
new_mode | MarginMode | yes | new margin mode |
Adjust Isolated Margin
perps.adjust_isolated_margin
Adjust allocated margin for an isolated position
| Field | Type | Required | Description |
|---|---|---|---|
owner | Option<EthereumAddress> | no | Optional owner when signed by a delegate |
market_id | MarketId | yes | market of the isolated position |
vault_id | Option<uint64> | no | Optional vault ID — when set, sender must be vault manager/owner |
subaccount_id | SubAccountId | yes | subaccount of the isolated position |
margin_adjustment | int128 | yes | margin adjustment (positive = add margin, negative = remove margin) |
Crank Mark Price
perps.crank_mark_price
Crank the mark price for a market Updates EMA state and emits MarkPriceUpdated event Can be called a maximum of once every 500ms
Protocol / admin operation.
| Field | Type | Required | Description |
|---|---|---|---|
market_id | MarketId | yes |
Crank Stop Orders
perps.crank_stop_orders
Crank stop orders for a market
Protocol / admin operation.
| Field | Type | Required | Description |
|---|---|---|---|
market_id | MarketId | yes |
Sample Premium
perps.sample_premium
Sample premium rate for funding Should be called once every minute
Protocol / admin operation.
| Field | Type | Required | Description |
|---|---|---|---|
market_id | MarketId | yes |
Apply Funding
perps.apply_funding
Apply funding to market Should be called at the top of every hour
Protocol / admin operation.
| Field | Type | Required | Description |
|---|---|---|---|
market_id | MarketId | yes |
Crank All Mark Prices
perps.crank_all_mark_prices
Crank mark price for all markets Should be called every 500ms
Protocol / admin operation.
No parameters.
Sample All Premiums
perps.sample_all_premiums
Sample premium rate for all markets Should be called once every minute
Protocol / admin operation.
No parameters.
Apply All Funding
perps.apply_all_funding
Apply funding to all markets Should be called at the top of every hour
Protocol / admin operation.
No parameters.
Liquidate Account
perps.liquidate_account
Liquidate an account
Protocol / admin operation.
| Field | Type | Required | Description |
|---|---|---|---|
user | EthereumAddress | yes | The user address to liquidate |
subaccount_id | SubAccountId | yes | The subaccount to liquidate |
Liquidate Position
perps.liquidate_position
Liquidate a single isolated position
Protocol / admin operation.
| Field | Type | Required | Description |
|---|---|---|---|
user | EthereumAddress | yes | The user address to liquidate |
subaccount_id | SubAccountId | yes | The subaccount to liquidate |
market_id | MarketId | yes | The market to liquidate |
Adl Position
perps.adl_position
Auto-Deleverage a position against specified counterparties
Called by an offchain process when: 1. A liquidation failed and escalated to "ADL required" error 2. A flash crash makes an account directly have negative equity
The counterparties list should be sorted by the offchain process using: (mark_price / entry_price) * (notional_position / account_value)
Protocol / admin operation.
| Field | Type | Required | Description |
|---|---|---|---|
user | EthereumAddress | yes | The user address whose position needs to be ADL'd |
subaccount_id | SubAccountId | yes | The subaccount to ADL |
market_id | MarketId | yes | The market in which to ADL |
counterparties | Vec<(EthereumAddress, SubAccountId)> | yes | List of (address, subaccount) pairs to ADL against, in priority order These should be opposite-side positions with positive PnL |
Adl Cross Account
perps.adl_cross_account
Auto-deleverage all cross-margin positions with proportional deficit distribution
This is called by an offchain process when a cross-margin account has negative equity and cannot be handled by backstop liquidation. The deficit is distributed proportionally across all positions with negative uPnL.
Counterparties must have zero prices that "align" with the bankruptcy prices, meaning ADL won't reduce their health.
Protocol / admin operation.
| Field | Type | Required | Description |
|---|---|---|---|
user | EthereumAddress | yes | The user address whose account needs to be ADL'd |
subaccount_id | SubAccountId | yes | The subaccount to ADL |
counterparties_by_market | Vec<(MarketId, Vec<(EthereumAddress, SubAccountId)>)> | yes | Map of market_id to list of (address, subaccount) counterparty pairs Counterparties should be sorted by: (mark_price / entry_price) * (notional / account_value) |
Deposit To BLP
perps.deposit_to_b_l_p
Deposit margin into the BLP and receive shares
| Field | Type | Required | Description |
|---|---|---|---|
quote_lots | uint64 | yes | Amount of margin to deposit (quote lots) |
source | VaultDepositSource | yes | Source of funds (spot or margin) |
subaccount_id | Option<SubAccountId> | no | The subaccount to deposit from (defaults to 0) |
Withdraw From BLP
perps.withdraw_from_b_l_p
Withdraw from the BLP by burning shares
| Field | Type | Required | Description |
|---|---|---|---|
shares | uint128 | yes | Amount of shares to withdraw |
destination | VaultWithdrawDestination | yes | Destination of funds (spot or margin) |
subaccount_id | Option<SubAccountId> | no | The subaccount to withdraw to (defaults to 0) |
Add BLP Manager
perps.add_b_l_p_manager
Add an BLP manager (admin only)
Protocol / admin operation.
| Field | Type | Required | Description |
|---|---|---|---|
manager | EthereumAddress | yes | The address to add as an BLP manager |
Remove BLP Manager
perps.remove_b_l_p_manager
Remove an BLP manager (admin only)
Protocol / admin operation.
| Field | Type | Required | Description |
|---|---|---|---|
manager | EthereumAddress | yes | The address to remove as an BLP manager |
Create Vault
perps.create_vault
Create a new vault with a required initial deposit
| Field | Type | Required | Description |
|---|---|---|---|
initial_deposit | uint64 | yes | Initial deposit amount (quote atoms) |
Deposit To Vault
perps.deposit_to_vault
Deposit margin into a vault and receive shares
| Field | Type | Required | Description |
|---|---|---|---|
vault_id | uint64 | yes | The vault ID to deposit into |
amount | uint64 | yes | Amount of margin to deposit (quote atoms) |
source | Option<VaultDepositSource> | no | Source of funds (spot or margin). Defaults to Spot if not specified. |
subaccount_id | Option<SubAccountId> | no | The subaccount to deposit from (defaults to 0) |
Withdraw From Vault
perps.withdraw_from_vault
Withdraw from a vault by burning shares
| Field | Type | Required | Description |
|---|---|---|---|
vault_id | uint64 | yes | The vault ID to withdraw from |
shares | uint128 | yes | Amount of shares to burn |
destination | Option<VaultWithdrawDestination> | no | Destination for withdrawn funds (spot or margin). Defaults to Spot if not specified. |
subaccount_id | Option<SubAccountId> | no | The subaccount to withdraw to (defaults to 0) |
Add Vault Manager
perps.add_vault_manager
Add a vault manager (vault owner only)
Protocol / admin operation.
| Field | Type | Required | Description |
|---|---|---|---|
vault_id | uint64 | yes | The vault ID |
manager | EthereumAddress | yes | The address to add as a manager |
Remove Vault Manager
perps.remove_vault_manager
Remove a vault manager (vault owner only)
Protocol / admin operation.
| Field | Type | Required | Description |
|---|---|---|---|
vault_id | uint64 | yes | The vault ID |
manager | EthereumAddress | yes | The address to remove as a manager |
Propose Vault Ownership Transfer
perps.propose_vault_ownership_transfer
Propose ownership transfer for a vault (current owner only). The new owner must call AcceptVaultOwnershipTransfer to complete.
Protocol / admin operation.
| Field | Type | Required | Description |
|---|---|---|---|
vault_id | uint64 | yes | The vault ID |
new_owner | EthereumAddress | yes | The proposed new owner |
Accept Vault Ownership Transfer
perps.accept_vault_ownership_transfer
Accept a pending vault ownership transfer (proposed new owner only).
Protocol / admin operation.
| Field | Type | Required | Description |
|---|---|---|---|
vault_id | uint64 | yes | The vault ID |
Freeze Vault
perps.freeze_vault
Freeze a vault (admin only). Blocks deposits, withdrawals, and trading.
Protocol / admin operation.
| Field | Type | Required | Description |
|---|---|---|---|
vault_id | uint64 | yes | The vault ID to freeze |
Unfreeze Vault
perps.unfreeze_vault
Unfreeze a vault (admin only)
Protocol / admin operation.
| Field | Type | Required | Description |
|---|---|---|---|
vault_id | uint64 | yes | The vault ID to unfreeze |
Set BLP Status
perps.set_b_l_p_status
Set BLP operational status (admin only)
Protocol / admin operation.
| Field | Type | Required | Description |
|---|---|---|---|
status | BLPStatus | yes | The new BLP status |
Update Fee Recipient
perps.update_fee_recipient
Update the protocol fee recipient address (admin only) The fee recipient receives protocol fee shares from BLP profits
Protocol / admin operation.
| Field | Type | Required | Description |
|---|---|---|---|
fee_recipient | EthereumAddress | yes | New fee recipient address |
Update BLP Protocol Fee
perps.update_b_l_p_protocol_fee
Update the BLP protocol fee rate (admin only) Fee is in 100ths of basis points (10000 = 1%)
Protocol / admin operation.
| Field | Type | Required | Description |
|---|---|---|---|
protocol_fee_100th_bps | uint16 | yes | New protocol fee rate (max 50000 = 5%) |
Set Fee Override
perps.set_fee_override
Set fee override for an address (admin only)
Protocol / admin operation.
| Field | Type | Required | Description |
|---|---|---|---|
user | EthereumAddress | yes | |
maker_fee_100th_bps | SignedBPS100thFee | yes | |
taker_fee_100th_bps | SignedBPS100thFee | yes |
Update Backstop Risk Config
perps.update_backstop_risk_config
Update backstop risk configuration (admin only) Controls when the BLP can absorb liquidated positions
Protocol / admin operation.
| Field | Type | Required | Description |
|---|---|---|---|
config | BackstopRiskConfig | yes |
Remove Fee Override
perps.remove_fee_override
Remove fee override for an address (admin only)
Protocol / admin operation.
| Field | Type | Required | Description |
|---|---|---|---|
user | EthereumAddress | yes |
Withdraw Accumulated Fees
perps.withdraw_accumulated_fees
Withdraw accumulated trading fees to the fee_recipient (admin only)
Protocol / admin operation.
| Field | Type | Required | Description |
|---|---|---|---|
amount | uint64 | yes | Amount to withdraw in quote atoms |
Update Vault Withdrawal Timelock
perps.update_vault_withdrawal_timelock
Update the vault withdrawal timelock duration (admin only) Controls how long users must wait after their last deposit before withdrawing
Protocol / admin operation.
| Field | Type | Required | Description |
|---|---|---|---|
timelock_ms | uint64 | yes | New timelock duration in milliseconds (max 10 days = 864000000) |
Update Blp Withdrawal Timelock
perps.update_blp_withdrawal_timelock
Update the BLP withdrawal timelock duration (admin only) Controls how long users must wait after their last deposit before withdrawing
| Field | Type | Required | Description |
|---|---|---|---|
timelock_ms | uint64 | yes | New timelock duration in milliseconds (max 10 days = 864000000) |
Pause Market
perps.pause_market
Pause a perp market (admin only). Blocks new orders, cranks (mark price, stop triggers), and funding. Users can still cancel their own orders. On unpause, the first crank updates mark price from oracle and liquidations fire naturally.
Protocol / admin operation.
| Field | Type | Required | Description |
|---|---|---|---|
market_id | MarketId | yes | The market to pause |
Unpause Market
perps.unpause_market
Unpause a paused perp market (admin only).
Protocol / admin operation.
| Field | Type | Required | Description |
|---|---|---|---|
market_id | MarketId | yes | The market to unpause |
Delist Market
perps.delist_market
Delist a perp market and initiate final settlement (admin only). Blocks all new orders. Existing positions must be settled via SettleDelistedPositions.
Protocol / admin operation.
| Field | Type | Required | Description |
|---|---|---|---|
market_id | MarketId | yes | The market to delist |
settlement_price | Option<uint64> | no | Settlement price. If None, uses current oracle price. |
Settle Delisted Position
perps.settle_delisted_position
Settle a position in a delisted market at the settlement price.
Expected keeper flow: 1. Identify all accounts whose margin would go negative at settlement price (margin_balance + PnL < 0 for cross, allocated + PnL < 0 for isolated) 2. ADL those accounts first via AdlPosition (socializes loss to counterparties) 3. Settle everyone else in batches with this call — includes profitable positions, losing positions with sufficient margin, and any remaining positions
This call rejects accounts that would go negative (must ADL first). Accounts with large losses but sufficient margin are settled normally.
Protocol / admin operation.
| Field | Type | Required | Description |
|---|---|---|---|
market_id | MarketId | yes | The delisted market |
user | EthereumAddress | yes | The user whose position to settle |
subaccount_id | SubAccountId | yes | The subaccount |
Add Adl Keeper
perps.add_adl_keeper
Add an authorized ADL keeper (admin only)
ADL keepers are authorized to call AdlPosition and AdlCrossAccount. This gates ADL operations to trusted off-chain processes.
Protocol / admin operation.
| Field | Type | Required | Description |
|---|---|---|---|
keeper | EthereumAddress | yes | The address to authorize as an ADL keeper |
Remove Adl Keeper
perps.remove_adl_keeper
Remove an ADL keeper (admin only)
Protocol / admin operation.
| Field | Type | Required | Description |
|---|---|---|---|
keeper | EthereumAddress | yes | The address to remove from ADL keepers |