Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Polymarket/ctf-exchange/llms.txt

Use this file to discover all available pages before exploring further.

Overview

The Hashing mixin provides EIP712 typed structured data hashing functionality for orders. It inherits from OpenZeppelin’s EIP712 contract and implements order hashing according to the EIP712 standard, which mirrors the hashing done in client libraries used to prepare and sign orders. Source: src/exchange/mixins/Hashing.sol

State Variables

domainSeparator

bytes32 public immutable domainSeparator
The EIP712 domain separator, computed during contract construction using the _domainSeparatorV4() function from the parent EIP712 contract.

Constructor

constructor(string memory name, string memory version) EIP712(name, version)
Initializes the Hashing contract by setting the domain separator and calling the parent EIP712 constructor.

Parameters

  • name (string): The name of the signing domain
  • version (string): The current major version of the signing domain

Functions

hashOrder

function hashOrder(Order memory order) public view override returns (bytes32)
Computes the EIP712 typed data hash for an order. This function hashes an Order object according to the EIP712 procedure for hashing and signing typed structured data.

Parameters

  • order (Order): The order object to hash, containing fields such as:
    • salt: Random value for uniqueness
    • maker: Address of the order maker
    • signer: Address of the signer
    • taker: Address of the taker (or zero address for any taker)
    • tokenId: The token ID being traded
    • makerAmount: Amount provided by maker
    • takerAmount: Amount provided by taker
    • expiration: Order expiration timestamp
    • nonce: Maker’s nonce for order cancellation
    • feeRateBps: Fee rate in basis points
    • side: Order side (buy/sell)
    • signatureType: Type of signature used

Returns

  • bytes32: The typed data hash of the order object

Implementation Details

The order hash is computed by:
  1. Encoding all order fields with the ORDER_TYPEHASH
  2. Hashing the encoded data with keccak256
  3. Passing the hash through _hashTypedDataV4() to combine it with the domain separator
This ensures that the order hash is unique to this specific contract instance and chain, preventing cross-chain replay attacks.

Build docs developers (and LLMs) love