OrderBook.sol
Storage
Order Struct
struct Order {
// --- Slot 1 (31 bytes) ---
address owner; // 20 bytes — order placer
Side side; // 1 byte — Bid, Ask, SellYes, or SellNo
OrderType orderType; // 1 byte — GTC or GTB
uint8 tick; // 1 byte — price tick 1-99 (price = tick/100)
uint64 lots; // 8 bytes — remaining lots (each lot = LOT_SIZE = 1e16 = $0.01)
// --- Slot 2 (21 bytes) ---
uint64 id; // 8 bytes — unique order ID
uint32 marketId; // 4 bytes — market this order belongs to
uint32 batchId; // 4 bytes — batch ID when order was placed
uint40 timestamp; // 5 bytes — block.timestamp when placed
}Key Functions
placeOrder(marketId, side, orderType, tick, lots)
placeOrder(marketId, side, orderType, tick, lots)placeOrders(marketId, OrderParam[])
placeOrders(marketId, OrderParam[])replaceOrders(marketId, cancelOrderIds[], OrderParam[])
replaceOrders(marketId, cancelOrderIds[], OrderParam[])OrderParam Struct
cancelOrder(orderId)
cancelOrder(orderId)registerMarket(minLots, batchInterval, expiryTime)
registerMarket(minLots, batchInterval, expiryTime)Anti-Spam: Per-User Order Cap
Resting Orders (Price-Proximity Filtering)
Storage / Function
Description
Access Control
Events
Last updated