Polymarket CTF Exchange
The Polymarket CTF Exchange is an exchange protocol that facilitates atomic swaps between Conditional Tokens Framework (CTF) ERC1155 assets and an ERC20 collateral asset.The CTF Exchange has been audited by Chainsecurity. The audit report is available in the source repository.
Key Features
Hybrid-Decentralized Model
Combines offchain order matching with on-chain, non-custodial settlement for optimal performance and security
Atomic Swaps
Facilitates trustless atomic swaps between binary outcome tokens (ERC1155) and collateral assets (ERC20)
Advanced Matching
Supports three matching scenarios: Normal, Mint, and Merge operations for complementary outcome tokens
Symmetric Fees
Implements symmetric fee structure that preserves market integrity for complementary binary options
EIP-712 Signatures
Orders represented as signed typed structured data following the EIP-712 standard
Operator Model
Designated operators provide matching and execution services while settlement remains on-chain
How It Works
The exchange operates on a hybrid model:- Offchain Matching: An operator provides matching, ordering, and execution services
- Onchain Settlement: All settlements happen on-chain, non-custodially according to signed order messages
- Maker-Taker Model: Orders are matched in either one-to-one or many-to-one (maker to taker) relationships
Price improvement from matched orders is captured by the taking agent, ensuring efficient market dynamics.
Get Started
How It Works
Understand the hybrid-decentralized exchange model and matching scenarios
Deployments
View production deployments on Polygon and Amoy testnet
Core Concepts
Learn about matching scenarios, fees, and order structure
API Reference
Explore the CTFExchange contract and trading functions
Contract Architecture
TheCTFExchange contract inherits from multiple mixins that define core functionality:
- Auth: Access control for admin and operator roles
- Assets: Management of collateral and CTF tokens
- Fees: Symmetric fee calculation and distribution
- Trading: Core matching and execution logic
- Signatures: EIP-712 signature validation with ERC-1271 support
- NonceManager: Order nonce tracking and cancellation
- Pausable: Emergency pause functionality
- Registry: Registered token management
- AssetOperations: Mint and merge operations for complementary tokens