- Trade settlement — how matched orders execute on-chain, transfer tokens between vaults, and confirm balances.
- Market settlement — how real-world outcomes are proposed, challenged, and finalised, unlocking token redemptions.
Trade settlement lifecycle (fills & orders)
Trade settlement operates continuously during active market trading:- Off-chain match: Orders signed by vault owners (EIP-712 typed signatures with
signatureType = 1VAULT) match on price and size in thematching-coreengine. - Batch submission: The platform’s
match-submitterservice gathers matched trades and submits them toCTFExchange(for binary markets) orNegRiskCtfExchange(for neg-risk markets) viamatchOrdersorbatchMatchOrders. - On-chain execution:
- The exchange verifies maker/taker signatures against
VaultFactory.vaultOf(signer). - Transfers outcome tokens and collateral directly between the participant vaults.
- Deducts each leg’s quadratic fee (
fee = k × P × (1−P) × outcomeTokens). - Emits
OrderFilledandOrdersMatchedevents with monotonically increasingseqcounters. If an individual trade within a batch fails (e.g. expired TTL or already filled),batchMatchOrdersemitsMatchFailedand continues settling the remaining batch.
- The exchange verifies maker/taker signatures against
- Chain confirmation: The
chain-watcherservice indexes confirmed blocks, verifies contiguous event sequence numbers (seq), and publisheschain.fill_settledevents over NATS JetStream. - Balance projection:
exchange-serviceconsumeschain.fill_settledto:- Drain the buyer’s locked collateral (
chain_fill_settled_buyer_drain). - Credit the seller’s available USDC balance (
chain_fill_settled_seller_credit). - Release the seller’s locked position tokens (
chain_fill_settled_sell_release). - Transition the internal trade state from
matched/settlement_pendingtosettled.
- Drain the buyer’s locked collateral (
Market settlement — propose → challenge → finalize
Once the underlying real-world event concludes, market resolution begins. Binary and neg-risk markets follow the same propose → challenge → finalize pattern on their respective oracle contracts.Step 1 — Oracle source check
The market is configured with one or more data sources when listed. When configured source(s) yield an unambiguous outcome, the market becomes ready to propose. When data is unavailable, contradictory, or lacks a strict majority across configured sources, the market moves toDELAYED. See Void & delayed.
Step 2 — On-chain proposal
Binary markets:proposeAndFinalize(questionId) or proposeAndFinalizeBatch(questionIds).
Step 3 — Challenge window
transferFrom. The bond is fixed at proposal time (bondSnapshot). Only the first challenge is accepted. When challenged:
- Market status transitions to
DISPUTED. - The oracle triggers
oraclePauseMarketon the exchanges registered on that oracle, halting trading on that condition. - See Challenges.
Step 4a — No challenge, finalise
challengeDeadline has passed without a challenge. Internally calls ConditionalTokens.reportPayouts, unlocking position redemptions.
Step 4b — Challenge, re-verify
Once challenged,resolveChallengeConfirm and resolveChallengeOverride can only be executed after the challenge window deadline has elapsed (_requireChallenged enforces block.timestamp > challengeDeadline); voidMarket has no deadline gate. The platform reviews the evidence and resolves the dispute:
NegRiskOracle using resolveChallengeConfirm(marketId), resolveChallengeOverride(marketId, winnerIndex), resolveChallengeOverrideWithFairPrices(marketId, yesPayouts, noPayouts), or two-phase void (queueVoidMarket followed by voidMarket).
Neg-risk markets
Neg-risk markets group multiple binary questions under a singlenegRiskMarketId. Differences:
- Keyed by the group: Calls take
negRiskMarketId:proposeOutcome(negRiskMarketId, winnerIndex),challengeOutcome(negRiskMarketId),finalizeOutcome(negRiskMarketId). - Atomic group resolution: On finalisation, the winning question pays YES (
[1, 0]) and every sibling pays NO ([0, 1]) in one transaction. In exceptional cases the platform proposes fair-price splits (proposeOutcomeWithFairPrices). - Two-phase void: Voiding requires
queueVoidMarket(freezing conversions withMarketVoidQueued), followed byvoidMarket. Standard void ([1, 1]on every question) reverts withCannotVoidAfterConversionsif any trader has executedconvertPositions. - Redemption: Goes through the vault like any other market — see Redemption.
Crypto markets
Crypto markets settle as binary markets underOracle:
- Rule-based evidence: Outcomes derive from Chainlink Data Streams feeds (CoinGecko for dominance/market-cap products, Hyperliquid for
ANT-USDandOPENAI-USD) evaluated against immutable rules set at listing (targetPrice,direction,deadlineAt). - Touch products:
THRESHOLD_BY_DEADLINEandTHRESHOLD_DURING_MONTHlock YES on first touch, settling after the observation period ends. - Fast crypto windows: 15-minute Up/Down windows evaluate within 1–2 minutes of closing. When armed for the fast path, markets use a verified zero-second challenge window and settle via
proposeAndFinalize.
What you observe as a partner
Redemption
Outcome tokens are held in your vault, so redemption always executes through the vault contract. CallingConditionalTokens.redeemPositions directly from an EOA burns nothing and pays nothing.
Auto-redeem
Auto-redeem is active by default for all accounts. Once a market reachesRESOLVED or VOIDED, the platform automatically redeems held outcome tokens, pays the gas, and credits the USDC payout to your vault:
How auto-redeem operates under the hood:
AutoRedeemBackfillServiceincore-apiscans eligible positions on markets that reached their final status in the last 24 hours every minute, and on all finished markets every 15 minutes, processing oldest resolved markets first (RND-2728).- Enqueued jobs are dispatched to
match-submitter’sBatchOrchestratorService, which batches up to 32 redemptions into single atomic multicalls viaMulticallExecutor.aggregate3executingVault.redeemPositionsorVault.redeemPositionsNegRisk. - Paused or moratorium accounts are automatically skipped until restrictions are lifted.
GET /api/me/auto-redeem (portfolio:read) and PUT /api/me/auto-redeem with { "enabled": true | false } (vault:write or positions:write, maximum 10 changes per 24 hours). The PUT answers 409 account_provisioning while the account is still being set up and 401 account_closed for a closed account (403 account_unavailable on a multi_wallet key). Calls refused after authentication, such as the 409, count toward the 10 (RND-3723).
Claiming yourself
If auto-redeem is turned off, or for winnings below 1 USDC, claim positions manually:-
Gasless API —
POST /api/me/positions/redeem- Body:
{ "marketId": "...", "outcomeIndex": 0 }. - API-key callers require
vault:write(orpositions:write) scope and must include an owner-signedRedeemAuthorizationpayload inauth. - Returns
{ "jobId": "...", "status": "pending" }. PollGET /api/me/positions/redeem/{jobId}untilstatusisconfirmed. - Note:
POST /api/me/redemptionsreturns503 redeem_not_yet_enabled(reserved for future signature-gated co-signed redemption).
Generation 2:positions:writealso grants redeem, and the body takes an optionalvault. See Redeem. - Body:
-
Self-submitted on-chain
- Binary markets: Vault owner calls
Vault.redeemPositions(conditionId, indexSets). - Neg-risk markets: Vault owner calls
Vault.redeemPositionsNegRisk(marketId, questionIndex, amount). - Note: On-chain vault redemptions are gated to
msg.sender == vaultOwner || factory.isBackend(msg.sender). Payouts are credited directly toledgerERC20[collateral]within the vault.
- Binary markets: Vault owner calls
available balance in GET /api/me/balances. No further claim step is required.