Signed-order matching with the PS_QUADRATIC_V1 taker-fee curve.
CTFExchange is an order-matching contract that settles trades against ConditionalTokens. PredictStreet deploys it with the quadratic taker-fee formulafee = k × P × (1−P) × outcomeTokens.See Fees for the mathematical background.
Key entry points
Function
Caller
Purpose
fillOrder(Order, fillAmount)
onlyOperator
Direct fill against a resting order
fillOrders(Order[], fillAmounts[])
onlyOperator
Batch direct fills (reverts entire tx if any leg fails)
Multi-taker batch — per-taker reverts caught and emitted as MatchFailed so the rest of the batch settles
cancelOrders(bytes32[] orderHashes)
onlyOperator
Operator-side cancel by order hash. Normal cancels pass through the REST API; the operator flips isFilledOrCancelled on-chain.
cancelMyOrder(Order)
Vault owner
Self-cancel escape hatch. Only callable by the owner of the order.maker vault after that vault has initiated an emergency withdrawal (v.emergencyEverInitiated() == true).
Note: maker (and takerOrderMaker / takerMaker) is always the order’s vault address, not the signing EOA.
Security invariants
Signature replay impossible — every filled or cancelled order hash is recorded in orderStatus[hash].isFilledOrCancelled.
Maker authority cryptographic — the exchange accepts only signatureType = 1 (VAULT). The signature must recover to signer, and maker must equal vaultFactory.vaultOf(signer). Orders with deprecated signatureType = 0 revert with InvalidSignature().
Admin cannot seize funds — no admin function transfers user tokens or collateral.
Operator rotation — compromised operator keys can be immediately disabled via removeOperator(address).
MatchFailed reason codes
When batchMatchOrders catches a per-leg revert, the reason bytes contain the 4-byte selector of the custom error:
Selector
Custom error
Cause
0xc56873ba
OrderExpired()
Order expiration is in the past at execution time. Common with resting limit orders whose TTL elapsed before on-chain submission.
0x7b38b76e
OrderFilledOrCancelled()
Order hash already marked filled or cancelled on-chain (replay or duplicate match).
0xa0b94465
MismatchedTokenIds()
BUY matched against a SELL on a different outcome token.
0x66f8620a
InvalidComplement()
Matched orders are not opposite sides of the same market.
0x7f9a6f46
NotCrossing()
Proposed prices do not cross.
0x8baa579f
InvalidSignature()
Order signature failed validation: invalid signature type, signature does not recover to signer, or maker != vaultOf(signer).
0xe2cc6ad6
MakingGtRemaining()
Fill amount exceeds order’s remaining size.
0xdf4d8080
TooLittleTokensReceived()
Slippage check failed.
0x291aa27e
MakerInEmergency()
Maker vault has an active emergency withdrawal timelock or window.
0xaa43cb2d
MarketAlreadyResolved()
Attempted match on a market that has already resolved.
To avoid OrderExpired() settlement failures, sign orders with expiration = 0 (no on-chain expiry — skips the block.timestamp >= expiration check).
Neg-risk variant (NegRiskCtfExchange)
For multi-outcome markets, NegRiskCtfExchange inherits CTFExchange identically, but points its internal CT router to NegRiskAdapter. All order matching, fee calculation, and event semantics remain identical to CTFExchange.
Source
0x90EA87493E208A14011EC700Ac9cbAf4d064acc0 on
Blockscout.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"ADI Predictstreet","description":"Institutional-grade prediction market API — trading, settlement, and on-chain custody.","colors":{"primary":"#013CFF","light":"#3F67ED","dark":"#0028AE"},"logo":{"light":"https://mintcdn.com/ideasoft/m6stBITx7YzlhMtC/logo/light.svg?fit=max\u0026auto=format\u0026n=m6stBITx7YzlhMtC\u0026q=85\u0026s=67eed2cbc5343eb0cb47d0945877af3f","dark":"https://mintcdn.com/ideasoft/m6stBITx7YzlhMtC/logo/dark.svg?fit=max\u0026auto=format\u0026n=m6stBITx7YzlhMtC\u0026q=85\u0026s=c44812a23eae343855d6ec50450195a8"},"favicon":"https://mintcdn.com/ideasoft/m6stBITx7YzlhMtC/favicon.svg?fit=max\u0026auto=format\u0026n=m6stBITx7YzlhMtC\u0026q=85\u0026s=12febd8f21b779fb61083b446cab4a6f","api":{"playground":{"proxy":true}},"navbar":{"links":[{"href":"https://adipredictstreet.com/","label":"Web app"}]},"footer":{"socials":{"x":"https://x.com/predictstreet","github":"https://github.com/predictstreet"}},"styling":{"eyebrows":"section","latex":true},"contextual":{"options":["copy","view","chatgpt","claude"],"display":"header"},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"ideasoft","hasAudioNarration":false,"actualSubdomain":"ideasoft","customDomains":["docs.adipredictstreet.com"],"gitSource":{"type":"github","owner":"predictstreetproduction","repo":"predictstreet-docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":"","_id":"6b10d7d79ffae5051c40dd68"},"entitlements":{},"buildId":"6b12b1adba1b60174d3523fe","clientVersion":"0.0.4453","searchFilterCounts":[{"language":"default","tag":"API Reference","count":118},{"language":"default","tag":"Endpoints","count":111},{"language":"default","tag":"Documentation","count":65},{"language":"default","tag":"Portfolio","count":26},{"language":"default","tag":"Markets","count":21},{"language":"default","tag":"Withdrawals","count":15},{"language":"default","tag":"Orders","count":11},{"language":"default","tag":"WebSocket","count":10},{"language":"default","tag":"On-chain Contracts","count":8},{"language":"default","tag":"Public Profile","count":8}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"control","enabled":true,"payload":{"type":"string","value":"control"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"auth-vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"starterQuestions":[],"googleFontsInlined":false},"customCss":[{"filePath":"styles.css","content":":root{--adi-pearl-white: #FFFDFA;--adi-electric-orange: #FF710A;--adi-burgundy: #3E000D;--adi-bright-blue: #013CFF;--adi-sandy-white: #FFF9E1;--adi-pearl-white-mid: #EAEAEA;--adi-pearl-white-dark: #BEBEBE;--adi-electric-orange-light: #FD964B;--adi-electric-orange-dark: #B74D00;--adi-burgundy-light: #632431;--adi-burgundy-dark: #2B0009;--adi-bright-blue-light: #3F67ED;--adi-bright-blue-dark: #0028AE;--adi-sandy-white-light: #FFFBEC;--adi-sandy-white-dark: #E1D9B6}a,.link{color:var(--adi-bright-blue)}a:hover,.link:hover{color:var(--adi-bright-blue-dark)}.dark a,.dark .link{color:var(--adi-bright-blue-light)}.dark a:hover,.dark .link:hover{color:var(--adi-electric-orange-light)}::selection{background-color:var(--adi-electric-orange);color:var(--adi-pearl-white)}"}]}
{"page":{"pagePath":"concepts/contracts/ctf-exchange","slug":"/concepts/contracts/ctf-exchange","pageMetadata":{"title":"CTFExchange","description":"Signed-order matching with the PS_QUADRATIC_V1 taker-fee curve.","href":"/concepts/contracts/ctf-exchange"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Signed-order matching with the PS_QUADRATIC_V1 taker-fee curve.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Table,Tip}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Tip)_missingMdxReference(`Tip`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[_jsx(_components.code,{children:`CTFExchange`}),` is an order-matching contract that settles trades against `,_jsx(_components.code,{children:`ConditionalTokens`}),`. PredictStreet deploys it with the `,_jsx(_components.strong,{children:`quadratic taker-fee formula`}),` `,_jsx(_components.code,{children:`fee = k × P × (1−P) × outcomeTokens`}),`.`]}),`\n`,_jsxs(_components.p,{children:[`See `,_jsx(_components.a,{href:`/concepts/trading/fees`,children:`Fees`}),` for the mathematical background.`]}),`\n`,_jsx(Heading,{level:`2`,id:`key-entry-points`,children:`Key entry points`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Function`}),_jsx(_components.th,{children:`Caller`}),_jsx(_components.th,{children:`Purpose`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`fillOrder(Order, fillAmount)`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`onlyOperator`})}),_jsx(_components.td,{children:`Direct fill against a resting order`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`fillOrders(Order[], fillAmounts[])`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`onlyOperator`})}),_jsx(_components.td,{children:`Batch direct fills (reverts entire tx if any leg fails)`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`matchOrders(takerOrder, makerOrders[], takerFillAmount, makerFillAmounts[])`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`onlyOperator`})}),_jsx(_components.td,{children:`Single-taker batch match`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`batchMatchOrders(takerOrders[], makerOrders[][], takerFillAmounts[], makerFillAmounts[][])`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`onlyOperator`})}),_jsxs(_components.td,{children:[`Multi-taker batch — per-taker reverts caught and emitted as `,_jsx(_components.code,{children:`MatchFailed`}),` so the rest of the batch settles`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`cancelOrders(bytes32[] orderHashes)`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`onlyOperator`})}),_jsxs(_components.td,{children:[`Operator-side cancel by order hash. Normal cancels pass through the REST API; the operator flips `,_jsx(_components.code,{children:`isFilledOrCancelled`}),` on-chain.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`cancelMyOrder(Order)`})}),_jsx(_components.td,{children:`Vault owner`}),_jsxs(_components.td,{children:[`Self-cancel escape hatch. Only callable by the owner of the `,_jsx(_components.code,{children:`order.maker`}),` vault after that vault has initiated an emergency withdrawal (`,_jsx(_components.code,{children:`v.emergencyEverInitiated() == true`}),`).`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`registerToken(uint256 token0, uint256 token1, bytes32 conditionId)`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`onlyAdmin`})}),_jsx(_components.td,{children:`Registers complementary outcome tokens under a condition`})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[_jsx(_components.code,{children:`pauseTrading()`}),` / `,_jsx(_components.code,{children:`unpauseTrading()`})]}),_jsx(_components.td,{children:_jsx(_components.code,{children:`onlyAdmin`})}),_jsx(_components.td,{children:`Global trading emergency halt`})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[_jsx(_components.code,{children:`pauseUser(address user, uint256 duration)`}),` / `,_jsx(_components.code,{children:`unpauseUser(address user)`})]}),_jsx(_components.td,{children:_jsx(_components.code,{children:`onlyAdmin`})}),_jsxs(_components.td,{children:[`Blocks orders signed by `,_jsx(_components.code,{children:`user`}),` for `,_jsx(_components.code,{children:`duration`}),` seconds`]})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[_jsx(_components.code,{children:`pauseMarket(bytes32 conditionId)`}),` / `,_jsx(_components.code,{children:`unpauseMarket(bytes32 conditionId)`})]}),_jsx(_components.td,{children:_jsx(_components.code,{children:`onlyAdmin`})}),_jsx(_components.td,{children:`Halts or resumes trading on a specific market condition`})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[_jsx(_components.code,{children:`oraclePauseMarket(bytes32 conditionId)`}),` / `,_jsx(_components.code,{children:`oracleUnpauseMarket(bytes32 conditionId)`})]}),_jsx(_components.td,{children:_jsx(_components.code,{children:`onlyOracle`})}),_jsxs(_components.td,{children:[`Hook called atomically by `,_jsx(_components.code,{children:`Oracle`}),` on dispute, delay, or proposal clear`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`setOracle(address newOracle)`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`onlyAdmin`})}),_jsx(_components.td,{children:`Wires the lifecycle-pause oracle address`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`setVaultFactory(address factory)`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`onlyAdmin`})}),_jsxs(_components.td,{children:[`Wires the `,_jsx(_components.code,{children:`VaultFactory`}),` for signature verification`]})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[_jsx(_components.code,{children:`addOperator(address)`}),` / `,_jsx(_components.code,{children:`removeOperator(address)`})]}),_jsx(_components.td,{children:_jsx(_components.code,{children:`onlyAdmin`})}),_jsx(_components.td,{children:`Manages authorised operator hot keys`})]})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`fee-formula`,children:`Fee formula`}),`\n`,_jsxs(_components.p,{children:[`The contract executes the `,_jsx(_components.code,{children:`PS_QUADRATIC_V1`}),` parabolic curve (peak at P=0.5, smoothly decaying to zero at P=0 and P=1):`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`8`,language:`solidity`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`solidity`,children:_jsxs(_components.code,{language:`solidity`,numberOfLines:`8`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// ONE = 1e18; BPS_DIVISOR = 10_000`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// price = collateral per outcome token, in 1e18 fixed-point (ONE = 1.0)`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// BUY: fee charged in outcome tokens`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`fee_tokens `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` feeRateBps `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (ONE `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` price) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` outcomeTokens `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`/`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (BPS_DIVISOR `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ONE);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// SELL: fee charged in collateral proceeds`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`fee_collateral `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` feeRateBps `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` price `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (ONE `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` price) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` outcomeTokens `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`/`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (BPS_DIVISOR `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ONE `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ONE);`})]}),`\n`]})})}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`Peak fee (at P = 0.5): `,_jsx(_components.code,{children:`feeRateBps / 4 / BPS_DIVISOR`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`Cap: `,_jsx(_components.code,{children:`feeRateBps \u003c= MAX_FEE_RATE_BIPS (1000)`}),` (peak 2.5%).`]}),`\n`,_jsxs(_components.li,{children:[`Inspect `,_jsx(_components.code,{children:`getFeeFormulaId()`}),` on-chain to verify: returns `,_jsx(_components.code,{children:`bytes32(\"PS_QUADRATIC_V1\")`}),`.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`events`,children:`Events`}),`\n`,_jsxs(_components.p,{children:[`Every trade execution event includes a monotonically increasing `,_jsx(_components.code,{children:`seq`}),` counter:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`45`,language:`solidity`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`solidity`,children:_jsxs(_components.code,{language:`solidity`,numberOfLines:`45`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`event`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` OrderFilled`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` uint64`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` seq`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` uint64`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` batchPosition`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` bytes32`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` indexed`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` orderHash`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` address`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` indexed`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` maker`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` address`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` indexed`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` taker`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` uint256`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` makerAssetId`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` uint256`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` takerAssetId`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` uint256`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` makerAmountFilled`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` uint256`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` takerAmountFilled`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` uint256`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` fee`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` uint256`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` remainingAfter`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` // `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` = `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`order`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` fully`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` filled`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`event`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` OrdersMatched`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` uint64`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` seq`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` uint64`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` batchPosition`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` bytes32`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` indexed`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` takerOrderHash`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` address`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` indexed`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` takerOrderMaker`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` uint256`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` makerAssetId`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` uint256`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` takerAssetId`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` uint256`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` makerAmountFilled`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` uint256`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` takerAmountFilled`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`event`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` MatchFailed`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` uint64`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` seq`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` uint256`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` index`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` bytes32`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` indexed`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` takerOrderHash`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` address`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` indexed`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` takerMaker`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` address`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` takerSigner`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` uint256`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` takerTokenId`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` uint256`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` takerFillAmount`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` uint256`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` takerRemainingBefore`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` bytes`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` reason`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`event`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` OrderCancelled`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`uint64`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` seq`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`bytes32`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` indexed`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` orderHash`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`uint256`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` remainingBefore`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`event`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` FeeCharged`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`address`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` indexed`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` receiver`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`uint256`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` tokenId`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`uint256`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` amount`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`event`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` MarketTradingPaused`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`uint64`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` seq`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`bytes32`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` indexed`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` conditionId`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`address`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` indexed`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` pauser`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`event`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` MarketTradingUnpaused`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`uint64`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` seq`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`bytes32`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` indexed`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` conditionId`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`address`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` indexed`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` pauser`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`event`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` MarketOraclePaused`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`uint64`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` seq`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`bytes32`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` indexed`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` conditionId`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`address`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` indexed`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` oracle`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`event`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` MarketOracleUnpaused`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`uint64`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` seq`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`bytes32`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` indexed`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` conditionId`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`address`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` indexed`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` oracle`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Note: `,_jsx(_components.code,{children:`maker`}),` (and `,_jsx(_components.code,{children:`takerOrderMaker`}),` / `,_jsx(_components.code,{children:`takerMaker`}),`) is always the order’s `,_jsx(_components.strong,{children:`vault`}),` address, not the signing EOA.`]}),`\n`,_jsx(Heading,{level:`2`,id:`security-invariants`,children:`Security invariants`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Signature replay impossible`}),` — every filled or cancelled order hash is recorded in `,_jsx(_components.code,{children:`orderStatus[hash].isFilledOrCancelled`}),`.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Maker authority cryptographic`}),` — the exchange accepts only `,_jsx(_components.code,{children:`signatureType = 1`}),` (VAULT). The signature must recover to `,_jsx(_components.code,{children:`signer`}),`, and `,_jsx(_components.code,{children:`maker`}),` must equal `,_jsx(_components.code,{children:`vaultFactory.vaultOf(signer)`}),`. Orders with deprecated `,_jsx(_components.code,{children:`signatureType = 0`}),` revert with `,_jsx(_components.code,{children:`InvalidSignature()`}),`.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Admin cannot seize funds`}),` — no admin function transfers user tokens or collateral.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Operator rotation`}),` — compromised operator keys can be immediately disabled via `,_jsx(_components.code,{children:`removeOperator(address)`}),`.`]}),`\n`]}),`\n`,_jsxs(Heading,{level:`2`,id:`matchfailed-reason-codes`,children:[_jsx(_components.code,{children:`MatchFailed`}),` reason codes`]}),`\n`,_jsxs(_components.p,{children:[`When `,_jsx(_components.code,{children:`batchMatchOrders`}),` catches a per-leg revert, the reason bytes contain the 4-byte selector of the custom error:`]}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Selector`}),_jsx(_components.th,{children:`Custom error`}),_jsx(_components.th,{children:`Cause`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:_jsx(_components.code,{children:`0xc56873ba`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`OrderExpired()`})}),_jsxs(_components.td,{children:[`Order `,_jsx(_components.code,{children:`expiration`}),` is in the past at execution time. Common with resting limit orders whose TTL elapsed before on-chain submission.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:_jsx(_components.code,{children:`0x7b38b76e`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`OrderFilledOrCancelled()`})}),_jsx(_components.td,{children:`Order hash already marked filled or cancelled on-chain (replay or duplicate match).`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:_jsx(_components.code,{children:`0xa0b94465`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`MismatchedTokenIds()`})}),_jsx(_components.td,{children:`BUY matched against a SELL on a different outcome token.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:_jsx(_components.code,{children:`0x66f8620a`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`InvalidComplement()`})}),_jsx(_components.td,{children:`Matched orders are not opposite sides of the same market.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:_jsx(_components.code,{children:`0x7f9a6f46`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`NotCrossing()`})}),_jsx(_components.td,{children:`Proposed prices do not cross.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:_jsx(_components.code,{children:`0x8baa579f`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`InvalidSignature()`})}),_jsxs(_components.td,{children:[`Order signature failed validation: invalid signature type, signature does not recover to signer, or maker != `,_jsx(_components.code,{children:`vaultOf(signer)`}),`.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:_jsx(_components.code,{children:`0xe2cc6ad6`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`MakingGtRemaining()`})}),_jsx(_components.td,{children:`Fill amount exceeds order’s remaining size.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:_jsx(_components.code,{children:`0xdf4d8080`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`TooLittleTokensReceived()`})}),_jsx(_components.td,{children:`Slippage check failed.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:_jsx(_components.code,{children:`0x291aa27e`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`MakerInEmergency()`})}),_jsx(_components.td,{children:`Maker vault has an active emergency withdrawal timelock or window.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:_jsx(_components.code,{children:`0xaa43cb2d`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`MarketAlreadyResolved()`})}),_jsx(_components.td,{children:`Attempted match on a market that has already resolved.`})]})]})]}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[`To avoid `,_jsx(_components.code,{children:`OrderExpired()`}),` settlement failures, sign orders with `,_jsx(_components.code,{children:`expiration = 0`}),` (no on-chain expiry — skips the `,_jsx(_components.code,{children:`block.timestamp >= expiration`}),` check).`]})}),`\n`,_jsxs(Heading,{level:`2`,id:`neg-risk-variant-negriskctfexchange`,children:[`Neg-risk variant (`,_jsx(_components.code,{children:`NegRiskCtfExchange`}),`)`]}),`\n`,_jsxs(_components.p,{children:[`For multi-outcome markets, `,_jsx(_components.code,{children:`NegRiskCtfExchange`}),` inherits `,_jsx(_components.code,{children:`CTFExchange`}),` identically, but points its internal CT router to `,_jsx(_components.code,{children:`NegRiskAdapter`}),`. All order matching, fee calculation, and event semantics remain identical to `,_jsx(_components.code,{children:`CTFExchange`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`source`,children:`Source`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`0x90EA87493E208A14011EC700Ac9cbAf4d064acc0`}),` on\n`,_jsx(_components.a,{href:`https://explorer-bls.adifoundation.ai/address/0x90EA87493E208A14011EC700Ac9cbAf4d064acc0`,children:`Blockscout`}),`.`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"CTFExchange","description":"Signed-order matching with the PS_QUADRATIC_V1 taker-fee curve.","href":"/concepts/contracts/ctf-exchange"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Key entry points","slug":"key-entry-points","depth":2,"children":[]},{"title":"Fee formula","slug":"fee-formula","depth":2,"children":[]},{"title":"Events","slug":"events","depth":2,"children":[]},{"title":"Security invariants","slug":"security-invariants","depth":2,"children":[]},{"title":"MatchFailed reason codes","slug":"matchfailed-reason-codes","depth":2,"children":[]},{"title":"Neg-risk variant (NegRiskCtfExchange)","slug":"neg-risk-variant-negriskctfexchange","depth":2,"children":[]},{"title":"Source","slug":"source","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"ideasoft","siteName":"ADI Predictstreet","title":"CTFExchange - ADI Predictstreet","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-11-12T16:36:20.424Z","originalFileLocation":"concepts/contracts/ctf-exchange.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Signed-order matching with the PS_QUADRATIC_V1 taker-fee curve.\">\u003cmeta data-mint-head name=\"application-name\" content=\"ADI Predictstreet\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/ideasoft/T2TJrNWM5Wm-DXAw/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/ideasoft/T2TJrNWM5Wm-DXAw/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/ideasoft/T2TJrNWM5Wm-DXAw/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/ideasoft/T2TJrNWM5Wm-DXAw/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/ideasoft/T2TJrNWM5Wm-DXAw/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/ideasoft/T2TJrNWM5Wm-DXAw/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/ideasoft/T2TJrNWM5Wm-DXAw/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/ideasoft/T2TJrNWM5Wm-DXAw/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/ideasoft/T2TJrNWM5Wm-DXAw/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"CTFExchange - ADI Predictstreet\">\u003cmeta data-mint-head property=\"og:description\" content=\"Signed-order matching with the PS_QUADRATIC_V1 taker-fee curve.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"ADI Predictstreet\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.adipredictstreet.com/concepts/contracts/ctf-exchange\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://ideasoft.mintlify.site/_mintlify/api/og/v2?division=On-chain+Contracts\u0026amp;title=CTFExchange\u0026amp;description=Signed-order+matching+with+the+PS_QUADRATIC_V1+taker-fee+curve.\u0026amp;theme=bd21456dccaef7fe76d77282\u0026amp;signature=99c89867e2892bce771bfbabb0a9c4f3b435aa7227cdf969be39b6875c57ec86\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"CTFExchange - ADI Predictstreet\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Signed-order matching with the PS_QUADRATIC_V1 taker-fee curve.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://ideasoft.mintlify.site/_mintlify/api/og/v2?division=On-chain+Contracts\u0026amp;title=CTFExchange\u0026amp;description=Signed-order+matching+with+the+PS_QUADRATIC_V1+taker-fee+curve.\u0026amp;theme=bd21456dccaef7fe76d77282\u0026amp;signature=99c89867e2892bce771bfbabb0a9c4f3b435aa7227cdf969be39b6875c57ec86\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/ideasoft/T2TJrNWM5Wm-DXAw/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"ADI Predictstreet\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#013CFF\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.adipredictstreet.com/concepts/contracts/ctf-exchange\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/concepts/contracts/ctf-exchange.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.adipredictstreet.com/#organization\",\"name\":\"ADI Predictstreet\",\"url\":\"https://docs.adipredictstreet.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/ideasoft/m6stBITx7YzlhMtC/logo/light.svg?fit=max\u0026auto=format\u0026n=m6stBITx7YzlhMtC\u0026q=85\u0026s=67eed2cbc5343eb0cb47d0945877af3f\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.adipredictstreet.com#website\",\"name\":\"ADI Predictstreet\",\"url\":\"https://docs.adipredictstreet.com\",\"publisher\":{\"@id\":\"https://docs.adipredictstreet.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.adipredictstreet.com/concepts/contracts/ctf-exchange#webpage\",\"url\":\"https://docs.adipredictstreet.com/concepts/contracts/ctf-exchange\",\"name\":\"CTFExchange\",\"description\":\"Signed-order matching with the PS_QUADRATIC_V1 taker-fee curve.\",\"dateModified\":\"2026-11-12T16:36:20.424Z\",\"isPartOf\":{\"@id\":\"https://docs.adipredictstreet.com#website\"},\"breadcrumb\":{\"@id\":\"https://docs.adipredictstreet.com/concepts/contracts/ctf-exchange#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.adipredictstreet.com/concepts/contracts/ctf-exchange#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"On-chain Contracts\",\"item\":\"https://docs.adipredictstreet.com/concepts/contracts/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"CTFExchange\",\"item\":\"https://docs.adipredictstreet.com/concepts/contracts/ctf-exchange\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.adipredictstreet.com/concepts/contracts/ctf-exchange#article\",\"headline\":\"CTFExchange\",\"name\":\"CTFExchange\",\"description\":\"Signed-order matching with the PS_QUADRATIC_V1 taker-fee curve.\",\"url\":\"https://docs.adipredictstreet.com/concepts/contracts/ctf-exchange\",\"mainEntityOfPage\":{\"@id\":\"https://docs.adipredictstreet.com/concepts/contracts/ctf-exchange#webpage\"},\"dateModified\":\"2026-11-12T16:36:20.424Z\",\"publisher\":{\"@id\":\"https://docs.adipredictstreet.com/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.adipredictstreet.com#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"ADI Predictstreet\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"ADI Predictstreet\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/concepts/contracts/ctf-exchange.md","siteName":"ADI Predictstreet","nav":{"global":null,"tabs":[{"tab":"Documentation","groups":[{"group":"Getting Started","pages":[{"title":"Introduction","href":"/introduction"},{"title":"Quickstart","href":"/quickstart"},{"title":"Platform overview","href":"/platform-overview"},{"title":"Environment","href":"/environments"}]},{"group":"Authentication","pages":[{"title":"Authentication overview","href":"/auth/overview"},{"title":"API keys","href":"/auth/api-keys"},{"title":"Rate limits","href":"/auth/rate-limits"}]},{"group":"Vaults","pages":[{"title":"Vaults overview","href":"/concepts/vaults/overview"},{"title":"Backend auto-deploy","href":"/concepts/vaults/auto-deploy"},{"title":"Recovering expired split / merge locks","href":"/concepts/vaults/recovery"}]},{"group":"Vault generation 2","pages":[{"title":"Vault generation 2","href":"/concepts/vault-gen2/overview"},{"title":"Detect a market's generation","href":"/concepts/vault-gen2/market-generation"},{"title":"Upgrade and move USDC","href":"/concepts/vault-gen2/upgrade"},{"title":"Orders and vault operations","href":"/concepts/vault-gen2/vault-operations"},{"title":"API keys and WebSocket","href":"/concepts/vault-gen2/api-keys-websocket"},{"title":"Emergency exit and upgradeability","href":"/concepts/vault-gen2/emergency-exit"}]},{"group":"Deposits","pages":[{"title":"Deposits overview","href":"/concepts/deposits/overview"},{"title":"Deposit limits","href":"/concepts/deposits/limits"}]},{"group":"Trading","pages":[{"title":"Order lifecycle","href":"/concepts/trading/order-lifecycle"},{"title":"EIP-712 signing","href":"/concepts/trading/eip712-signing"},{"title":"Placing orders","href":"/concepts/trading/placing-orders"},{"title":"Cancelling orders","href":"/concepts/trading/cancelling"},{"title":"Time-in-force","href":"/concepts/trading/time-in-force"},{"title":"Fees","href":"/concepts/trading/fees"}]},{"group":"Events \u0026 Tags","pages":[{"title":"Events overview","href":"/concepts/events/overview"}]},{"group":"Markets","pages":[{"title":"Markets overview","href":"/concepts/markets/overview"},{"title":"Binary markets","href":"/concepts/markets/binary"},{"title":"Neg-risk markets","href":"/concepts/markets/neg-risk"},{"title":"Crypto markets","href":"/concepts/markets/crypto"},{"title":"Up/Down windows","href":"/concepts/markets/crypto-updown"},{"title":"Orderbook","href":"/concepts/markets/orderbook"},{"title":"Market status","href":"/concepts/markets/market-status"}]},{"group":"Portfolio","pages":[{"title":"Balances","href":"/concepts/portfolio/balances"},{"title":"Positions","href":"/concepts/portfolio/positions"},{"title":"Trades","href":"/concepts/portfolio/trades"},{"title":"Fee ledger","href":"/concepts/portfolio/fees"}]},{"group":"Withdrawals","pages":[{"title":"Withdrawals overview","href":"/concepts/withdrawals/overview"},{"title":"Dual-signature flow","href":"/concepts/withdrawals/dual-sig"},{"title":"WithdrawERC20 EIP-712","href":"/concepts/withdrawals/eip712"},{"title":"State machine","href":"/concepts/withdrawals/state-machine"},{"title":"Deposit sources","href":"/concepts/withdrawals/deposit-sources"},{"title":"Withdrawal 2FA (TOTP)","href":"/concepts/withdrawals/two-factor"},{"title":"Withdrawal address whitelist","href":"/concepts/withdrawals/address-whitelist"}]},{"group":"WebSocket","pages":[{"title":"WebSocket overview","href":"/concepts/websocket/overview"},{"title":"Subscriptions","href":"/concepts/websocket/subscriptions"},{"title":"Message shapes","href":"/concepts/websocket/messages"},{"title":"Crypto price feeds","href":"/concepts/websocket/crypto-price"},{"title":"Reconnect \u0026 resync","href":"/concepts/websocket/reconnect"}]},{"group":"Settlement \u0026 Oracle","pages":[{"title":"Settlement \u0026 oracle overview","href":"/concepts/settlement/overview"},{"title":"Settlement flow","href":"/concepts/settlement/flow"},{"title":"Challenges","href":"/concepts/settlement/challenges"},{"title":"Void \u0026 delayed markets","href":"/concepts/settlement/void-delay"}]},{"group":"On-chain Contracts","pages":[{"title":"Contracts overview","href":"/concepts/contracts/overview"},{"title":"Addresses","description":"Production contract address registry.","href":"/concepts/contracts/addresses"},{"title":"CTFExchange","href":"/concepts/contracts/ctf-exchange"},{"title":"VaultFactory + Vault","description":"Per-user custody with dual-sig withdrawals, operations, and emergency exit.","href":"/concepts/contracts/vaults"},{"title":"ConditionalTokens","href":"/concepts/contracts/conditional-tokens"},{"title":"NegRiskAdapter","href":"/concepts/contracts/neg-risk-adapter"},{"title":"Oracle","href":"/concepts/contracts/oracle"},{"title":"Audits","href":"/concepts/contracts/audits"}]},{"group":"Partners","pages":[{"title":"Partner Trades \u0026 Reconciliation","href":"/concepts/partners/trades-and-recon"},{"title":"Maintenance Notifications","href":"/concepts/partners/maintenance-notifications"},{"title":"Pausing Trading Around Maintenance","href":"/concepts/partners/pausing-around-maintenance"}]},{"group":"Errors","pages":[{"title":"Errors overview","href":"/errors/overview"},{"title":"Error codes","href":"/errors/codes"}]}]},{"tab":"API Reference","pages":[{"title":"API Reference","href":"/api-reference/introduction"}]}]},"basePath":"","title":"CTFExchange - ADI Predictstreet","deploymentId":"dpl_BLZw3QngerHodH9E8mGgC4v752y3","buildId":"dpl_BLZw3QngerHodH9E8mGgC4v752y3","dynamics":[],"chunks":[]}