Overview
The OrderStructs library defines the core data structures and enums used throughout the Polymarket CTF Exchange for order management and matching.ORDER_TYPEHASH
EIP-712 type hash used for order signature verification.Order
The main order struct representing a buy or sell order on the exchange.Fields
Unique salt to ensure entropy and uniqueness of order hashes
Maker of the order, i.e. the source of funds for the order
Signer of the order. For EOA signature types, must match the maker address
Address of the order taker. The zero address (
address(0)) is used to indicate a public order that anyone can fillToken ID of the CTF ERC1155 asset to be bought or sold
- If
BUY: This is the tokenId of the asset to be bought (makerAssetId) - If
SELL: This is the tokenId of the asset to be sold (takerAssetId)
Maker amount, i.e. the maximum amount of tokens to be sold by the maker
Taker amount, i.e. the minimum amount of tokens to be received by the maker
Timestamp after which the order is expired and can no longer be filled
Nonce used for onchain cancellations. Must match the maker’s current nonce
Fee rate in basis points (bps) charged to the order maker on proceeds. 100 bps = 1%
The side of the order:
BUY or SELLSignature type used by the order:
EOA, POLY_PROXY, POLY_GNOSIS_SAFE, or POLY_1271The order signature bytes
OrderStatus
Tracks the fill status of an order.Fields
Whether the order has been completely filled or cancelled
Remaining maker amount that can still be filled. When this reaches 0,
isFilledOrCancelled is set to trueSide
Enum representing the side of an order.Values
Buy order - maker is buying outcome tokens with collateral
Sell order - maker is selling outcome tokens for collateral
SignatureType
Enum representing the signature type used for order validation.Values
ECDSA EIP-712 signatures signed by Externally Owned Accounts (EOAs)
EIP-712 signatures signed by EOAs that own Polymarket Proxy wallets
EIP-712 signatures signed by EOAs that own Polymarket Gnosis Safes
EIP-1271 signatures signed by smart contracts. Used by smart contract wallets or vaults
MatchType
Enum representing the type of match between two orders.Values
Buy vs sell - a buy order matched with a sell order
Both buys - two buy orders matched together, requiring minting of new position tokens
Both sells - two sell orders matched together, resulting in merging of position tokens