Skip to main content

Module order_builder

Module order_builder 

Source
Expand description

Order builder for the Polymarket CLOB exchange.

Centralizes all order construction logic:

  • Limit and market order building
  • Order validation (side, TIF, quote_quantity)
  • EIP-712 signing
  • Maker/taker amount computation

Amounts are converted from human-readable decimals to on-chain base units (pUSD 10^6 / CTF shares 10^6) by truncating to USDC_DECIMALS (6) decimal places and extracting the mantissa as an integer.

The builder produces signed PolymarketOrder structs ready for HTTP submission.

Structs§

PolymarketOrderBuilder
Builds signed Polymarket orders for submission to the CLOB V2 exchange.

Constants§

ZERO_BYTES32
Zero bytes32 used for the metadata field (reserved for future use).

Functions§

compute_maker_taker_amounts
Builds the maker/taker amounts for a Polymarket CLOB limit order.
compute_market_maker_taker_amounts
Builds maker/taker amounts for a Polymarket market order.
generate_salt
Generates a random salt for order construction.