Data Structures
- Order —
{ address owner, uint96 size, uint40 prev, uint40 next, uint40 flippedId, uint32 price, uint32 flippedPrice, bool isBuy } - PricePoint —
{ uint40 head, uint40 tail } - TreeUint24 — Tree structure for active price points
Core Functions
Order Placement
_postOnly is true, reverts if any portion matches immediately.
Flip Orders
_flippedPrice must be better than _price. If _provisionOrRevert is false, reverts if best price equals current book best.
Market Orders
_isFOK enforces fill-or-kill behavior.
Cancellation
Liquidity Provision
addPairedLiquidity sets bid/ask prices and sizes. Batch function allows provisioning multiple price points at once.
View Functions
Market States
ACTIVE— Full operations enabledSOFT_PAUSED— Only cancels, deposits, withdrawals allowedHARD_PAUSED— All operations halted
Order Types
| Type | Description | prev | next |
|---|---|---|---|
| A | Single order | NULL | NULL |
| B | Head with next | NULL | NON-NULL |
| C | Middle order | NON-NULL | NON-NULL |
| D | Tail order | NON-NULL | NULL |
Events
OrderCreated
FlipOrderCreated
flippedId is the order ID that will be created on the opposite side when this order fills.
Trade
updatedSize is the remaining size after fill. origin is the original transaction sender (supports meta-transactions).