Midway

Concepts

The vault and reservation

One active order per wallet, and the whole vault reserved while it rests, so no reserve ever reveals an order's size.

Your vault is the balance you trade from: USDC and the market's stock, held by the settlement program for your wallet.

One order, whole vault#

Each wallet has one active order per market. While it rests, your entire vault is reserved for it: both the USDC and the stock.

That is deliberate. A reserve sized to the order would publish the order's size on chain. Reserving everything shows only that you have an order, not how large it is.

USDCStockNo order: deposit and withdrawUSDCStockOrder resting: whole vault reservedUSDCStockNo order: deposit and withdrawUSDCStockOrder resting: vault reserved

What you can do while an order rests#

ActionWhile an order rests
DepositYes. Deposits always go through.
WithdrawAfter the order is cancelled, fills completely, expires or is not admitted.
Seal another orderAfter the active one ends.
CancelYes, whenever the book is not in the middle of a computation.

When the reservation ends#

The vault is released the moment the order ends, whichever way:

  • it fills completely,
  • you cancel it,
  • it expires (a round removes it), or
  • it is not admitted because the vault couldn't cover it.

After that, everything not spent in fills is available to withdraw or to back the next order.