Reference
Programs and accounts
The two Solana programs behind Midway and the accounts they derive, for integrators and explorers.
Programs#
| Program | Address | Does |
|---|---|---|
| Settlement | A2gVbydTCBPuK1uPWm8UBAsoyC8EU753sMGaGbaCFTe6 | Vaults, deposits and withdrawals, reservations, Pyth snapshots, fill settlement, fees |
| Matching (Arcium MXE) | 7WR2gjtu1S6rxYEF3fEExipKaMffCCdeRhV973ffigoZ | The encrypted book, admissions, matching rounds, remaining-size reads, cancellation, the session calendar |
The matching program queues computations on Arcium and accepts their results only with the cluster's verified signature.
Accounts#
Every account is derived from fixed seeds, so anyone can find a market's accounts from its stock mint and administrator.
| Account | Program | Seeds |
|---|---|---|
| Market | Settlement | "market", stock mint, administrator |
| Your vault | Settlement | "trader", market, your wallet |
| USDC vault | Settlement | "quote-vault", market |
| Stock vault | Settlement | "stock-vault", market |
| Encrypted book | Matching | "book", market |
| Settlement authority | Matching | "settlement-authority", market |
Because the market's address includes its administrator, nobody else can create the market an administrator intends to open.
Events#
| Event | Program | Published when |
|---|---|---|
BalanceChanged | Settlement | a deposit or withdrawal moves a vault balance |
OrderLocked, OrderReleased | Settlement | a vault is reserved for an order, and released |
RoundStarted, RoundFinished | Settlement | a matching round takes its oracle snapshot, and closes |
FillSettled | Settlement | a fill settles: buyer, seller, quantity, price, notional, fee, slot |
FeesWithdrawn | Settlement | the administrator withdraws accrued fees |
BookInitialized | Matching | the book's sixteen sealed positions are ready |
OrderQueued | Matching | an encrypted order is queued for admission |
OrderAdmission | Matching | the book admits an order, or does not |
OrderRemoved | Matching | an order is cancelled or expires |
RemainingEncrypted | Matching | a remaining-size read returns its encrypted answer |
RoundDiscarded | Matching | a round's result is dropped because its oracle snapshot changed or aged |
ComputationRecovered | Matching | a computation pending for ten minutes is fenced |
CalendarUpdated | Matching | the administrator publishes sessions |