Skip to main content
CTFExchange is a Polymarket-compatible order-matching contract that settles trades against ConditionalTokens. PredictStreet deploys it with the quadratic taker-fee formula fee = k × P × (1−P) × outcomeTokens. See Fees for the math.

Key entry points

Fee formula

Cap: feeRateBps ≤ MAX_FEE_RATE_BIPS (1000).

Events

Security invariants

  • Signature replay impossible — every filled order’s hash stored in orderStatus[hash].isFilledOrCancelled.
  • Maker authority cryptographicmaker field verified against signer via vaultFactory.vaultOf(signer) (VAULT) or equality (EOA).
  • Admin can pause but not seize — no admin function transfers user funds.
  • Operator rotatableremoveOperator(address) disables compromised key.

MatchFailed reason codes

When batchMatchOrders catches a per-leg revert, the reason bytes are the 4-byte selector of the original custom error. Common ones: Decode the bytes with cast 4byte 0x<selector> or by computing bytes4(keccak256(<errorSig>)).
To avoid OrderExpired() settlement failures, sign orders with expiration = 0 (no on-chain expiry — the contract skips the block.timestamp >= expiration check entirely). UIs that need a hard TTL should set it well above worst-case settlement latency.

Source

Paste 0x4074c225b296E1E556c565B0C3Ddba305E63E7c4 on Blockscout for verified source + ABI.