Midway

Concepts

Fills, fees and settlement

The exact arithmetic of a fill: notional, the per-side fee, and how USDC and stock move between vaults.

A fill moves stock from the seller's vault to the buyer's and USDC the other way, at the midpoint, in one Solana transaction.

The arithmetic#

All amounts are whole on-chain units: USDC in millionths of a dollar, stock in its smallest unit.

QuantityRule
PriceThe Pyth price in USDC per share, rounded up to the next millionth
Notionalquantity × price, rounded up to the next USDC unit
Fee, each sidenotional × fee rate, rounded up
Buyer paysnotional + fee
Seller receivesnotional − fee

Both fees go to the market's fee account. Stock moves without rounding. Every USDC unit and every share is conserved: what leaves one vault arrives in another.

All of the fees buy $MIDWAY on the market, and the $MIDWAY bought is burned: see The $MIDWAY token.

A worked example#

A fill of 6 shares at a midpoint of $100.00:

Amount
Notional6 × $100.00 = $600.00
Fee, each side$600.00 × the market's fee rate, rounded up
Buyer pays$600.00 + the fee
Seller receives$600.00 − the fee

Settlement#

The fill is settled by the settlement program, which only the matching network's authority account can call, and only with a verified computation result. It checks both vaults again at the exact rounded amounts before anything moves. The fill is then published with its buyer, seller, quantity, price and slot, and appears under Your fills for both wallets.