Skip to Content

Block Conditions

Deposits

Your deposit is blocked if:

  • it would reach or exceed max_deposits for that spot asset

  • the spot market is in reduce-only mode and your deposit does not pay off a borrow

  • the spot market’s deposits are paused

  • the spot market is still in the Initialized status (not yet opened for trading)

  • your pool_id does not match the spot market’s pool_id

  • it would exceed the spot market’s daily deposit cap

Withdraws

Your withdrawal or borrow is blocked if:

  • you have outstanding liabilities and any oracle on an asset or liability you hold is invalid (“invalid” per the MarginCalc action)

  • it would increase your number of liabilities above 1 while one of them has the isolated asset tier (you can only hold one outstanding liability when that liability has the isolated asset tier)

  • it would put your total collateral (weighted collateral value) below your initial margin requirement

  • it would put that asset’s protocol liquidity below the rolling limits (these limits differ based on whether the withdraw would open a borrow)

Placing Orders

You cannot place an order if:

  • it is risk-increasing and would put your initial margin requirement above your total collateral

  • it would increase your number of outstanding liabilities above 1 while one of them has the isolated asset tier

Order placement applies to perpetual markets only. Spot order placement is removed on Velocity (there is no spot order book). Borrows are instead opened through withdrawals and swaps, which are governed by the withdrawal conditions above.

Filling Orders

Your order won’t fill if it would send you under the margin requirement plus buffer (you’d hit InsufficientCollateral). Within a match, if either side hits this condition, the match won’t go through.

Settle Perp PnL

You can’t settle perp PnL if:

  • the market’s oracle is deemed invalid

  • you have negative unrealized PnL and your account value is below the maintenance margin requirement (this check does not apply when you’re settling positive unrealized PnL)

  • the market’s oracle price diverges too far from its 5-minute TWAP (validate_market_within_price_band)

  • a third party (not your authority or delegate) tries to settle your negative PnL against a margin-invalid oracle

  • the SettlePnl (or, if you have an open position, SettlePnlWithPosition) operation is paused for the market

  • the market has an open position and its status is not Active, or has no open position and its status is neither Active nor ReduceOnly

Pause and market-status gating

Every condition above is a rule about your account or your action. Pauses are different: they are switches an admin flips, and they block an action for everyone. There are three independent layers, and your action must clear all three.

Layer 1: the exchange-wide breaker (State.exchangeStatus)

State.exchangeStatus is a u8 bitmask (ExchangeStatus, state/state.rs). 0 means fully active; each bit halts one class of action across every market.

BitValueWhat it blocksError
DepositPaused0b0000_0001all depositsExchangePaused
WithdrawPaused0b0000_0010all withdrawals, borrows, and pool transfersExchangePaused
AmmPaused0b0000_0100AMM as a counterparty (the AMM stops being available in a fill)ExchangePaused
FillPaused0b0000_1000order fills, order triggering, revert_fill, and liquidate_perp_with_fillExchangePaused
LiqPaused0b0001_0000liquidationsExchangePaused
FundingPaused0b0010_0000funding-rate updates and spot interest accrualExchangePaused
SettlePnlPaused0b0100_0000PnL settlementExchangePaused
AmmImmediateFillPaused0b1000_0000auction-skipping immediate AMM fills (auctions must run their full duration)no error, the fill just waits

Two of these have effects worth calling out:

  • FillPaused also blocks triggering. trigger_order starts an order’s auction and pays the keeper reward, so it is part of the fill lifecycle and carries the same gate as fill_perp_order. A stop or take-profit order will not be triggered while fills are paused.
  • A full halt is its own condition. Some instructions (signed-message taker order placement, spot interest refresh, several keeper cranks) are gated on exchange_not_paused, which fails only when every bit is set. Those instructions keep working during a partial pause and stop only in a complete halt.

Layer 2: per-market pause bits (paused_operations)

Each market carries its own bitmask, so one market can be frozen while the rest of the exchange trades normally.

Perp markets (PerpMarket.pausedOperations, PerpOperation):

BitValueWhat it blocksError
UpdateFunding0b0000_0001funding-rate updates for this marketno error, the crank returns without updating
AmmFill0b0000_0010the AMM filling orders in this marketno error, the AMM is skipped as a counterparty
Fill0b0000_0100fills and triggering in this marketMarketFillOrderPaused
SettlePnl0b0000_1000settling PnL, including expired-position settlementInvalidMarketStatusToSettlePnl
SettlePnlWithPosition0b0001_0000settling PnL while an open base position remainsInvalidMarketStatusToSettlePnl
Liquidation0b0010_0000liquidating this perp positionInvalidLiquidation
AmmImmediateFill0b0100_0000auction-skipping immediate AMM fills in this marketno error, the auction runs its full duration
SettleRevPool0b1000_0000sweeping this market’s revenue share to the revenue poolno error, the sweep returns early

Spot markets (SpotMarket.pausedOperations, SpotOperation):

BitValueWhat it blocksError
UpdateCumulativeInterest0b0000_0001interest accrual for this marketno error, accrual is skipped
Fill0b0000_0010fills against this spot marketMarketFillOrderPaused
Deposit0b0000_0100deposits, including the deposit leg of a transfer_pools and any credit into the revenue poolMarketActionPaused
Withdraw0b0000_1000withdrawals and borrowsMarketWithdrawPaused
Liquidation0b0001_0000liquidating a position in this marketInvalidLiquidation

Insurance funds (SpotMarket.insuranceFund.pausedOperations, InsuranceFundOperation): Init, Add, RequestRemove, and Remove each gate the matching staking instruction and reject with InsuranceFundOperationPaused. See Insurance Fund Staking.

A warm admin may only flip UpdateFunding and SettleRevPool on a perp market (PerpOperation::WARM_EDITABLE). Every other bit is reserved for the cold or pause admin, and a warm update preserves the bits it is not allowed to touch.

Layer 3: market status

Status is a single value, not a bitmask, and it gates actions on its own:

ActionStatuses that allow itError otherwise
Place a perp ordernot Settlement (an order placed while the market is ReduceOnly is forced reduce-only)MarketPlaceOrderPaused
Fill a perp orderActive or ReduceOnly, and not in settlementMarketFillOrderPaused
Spot depositnot Initialized; must be Active if the resulting position is a positive deposit balanceMarketBeingInitialized, MarketActionPaused
Spot withdraw or borrowActive, ReduceOnly, or SettlementMarketWithdrawPaused
Settle perp PnLActive with an open position, Active or ReduceOnly with nonesee Settle Perp PnL above

A ReduceOnly perp market forces every fill to be risk-reducing, including fills of orders placed earlier. Order placement stamps reduce_only from the market status at the time the order was created, so an order placed while the market was Active still carries reduce_only = false after the market flips. The fill path therefore re-derives reduce-only from the live market status and stamps it onto the order, for the taker and every maker in the match. A resting maker quote that would increase exposure is then size-clamped to the position it can close, or cancelled outright. If you keep quotes on a market that is being delisted, expect them to stop adding exposure the moment the status changes, not the moment you replace them.

Telling a pause apart from a bug

  • ExchangePaused (error 6024) is always exchange-wide. Read State.exchangeStatus to see which bit is set.
  • MarketActionPaused (6146), MarketPlaceOrderPaused (6147), MarketFillOrderPaused (6148), and MarketWithdrawPaused (6149) are always scoped to one market. Read that market’s status and pausedOperations.
  • The program logs every set bit by name ("<Operation> is paused") when it rejects, so the transaction logs name the exact bit.
  • A silent no-op (no error, the action simply does not happen) is the expected shape for the funding, interest-accrual, AMM-fill, and revenue-sweep bits. Do not treat an unchanged funding rate or a skipped AMM fill as a failed transaction.
Last updated on