Skip to main content
The Conditional Token Framework (CTF) serves as the settlement substrate for prediction market positions on PredictStreet. It is based on Gnosis Conditional Tokens (via Polymarket’s fork), upgraded to Solidity 0.8.31 and OpenZeppelin ERC-1155 base contracts with monotonic sequence counters (seq) on every state event. Do not decode event logs using upstream or third-party Polymarket ABIs, as the event signatures differ (see Events).

Key concepts

  • Condition — An (oracle, questionId, outcomeSlotCount) tuple identified by:
  • Collection — Disjoint sets of outcome slots under a condition.
  • Position — An ERC-1155 balance of a specific outcome slot within a condition, backed by collateral:
  • Redemption — Once the oracle reports payouts, winning outcome tokens are burned in exchange for collateral.

Prepare a condition

Called by the platform when deploying a new market. Emits ConditionPreparation.

Redeem winning positions

Redeeming your positions

On PredictStreet, outcome tokens sit in your Vault, not in your EOA. ConditionalTokens.redeemPositions pays out only to the caller (msg.sender); calling it directly from your EOA burns nothing and pays nothing. Redemption is executed through one of the following paths:
  • Automatic (default): Auto-redeem is active for all accounts. Within a few minutes of final market status, the platform’s AutoRedeemBackfillService enqueues eligible positions, and match-submitter executes Vault.redeemPositions in multicall batches (MulticallExecutor.aggregate3), paying the gas for you. It redeems:
    • Full refunds on voided markets (no minimum floor; dust under 0.001 shares skipped).
    • Winnings on resolved markets that total at least 1 USDC per market.
    • Smaller balances stay in your account for manual claim. Configure via GET / PUT /api/me/auto-redeem.
  • Gasless API — POST /api/me/positions/redeem:
    • Call with { "marketId": "...", "outcomeIndex": 0 } (vault:write or positions:write).
    • API-key callers must provide auth: { deadline, v, r, s } signing an EIP-712 RedeemAuthorization(address owner, string marketId, uint8 outcomeIndex, uint256 deadline) under domain { name: "PredictStreetRedeem", version: "1", chainId }.
    • Returns { jobId, status }. Poll GET /api/me/positions/redeem/{jobId} until confirmed.
    • Note: POST /api/me/redemptions returns 503 redeem_not_yet_enabled.
  • On-chain, from the vault-owner EOA:
    • Binary markets: vault.redeemPositions(conditionId, indexSets).
    • Neg-risk markets: vault.redeemPositionsNegRisk(marketId, questionIndex, amount).
    • Callable by vaultOwner or backend; credits payout directly to ledgerERC20[collateral] within the vault.
Every path credits the USDC payout directly to your vault, updating the USDC row’s available balance in GET /api/me/balances.

Events

All state-changing events emit a global, monotonic seq counter as their first argument:
The seq counter increments monotonically across all five events. chain-watcher verifies seq == lastSeq + 1 to ensure zero gaps in event indexing.

Differences from upstream

  1. Monotonic sequence counters (seq): Every event starts with uint64 seq for gap detection and deterministic cross-contract ordering.
  2. Return value: redeemPositions returns uint256 totalPayout.
  3. Event indexing: PayoutRedemption indexes conditionId instead of parentCollectionId.
  4. Base contract: Implemented using OpenZeppelin ERC-1155 with transient storage sequence flushing (_flushSeq).

Source

0xD28B8295Cd57F205e4d080Ff4c6d23C06a9EEe3a on Blockscout.