OrderBook.sol
存储
订单 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
}关键函数
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: 每用户订单上限
休眠订单(价格接近度过滤)
存储 / Function
Description
访问控制
事件
Last updated

