Overview
The UMA CTF Adapter serves as an oracle bridge between the Conditional Tokens Framework (CTF) and UMA’s Optimistic Oracle V2. It enables Polymarket prediction markets to be resolved using UMA’s optimistic dispute resolution mechanism.Contract Architecture
The adapter system consists of three main components:Core Components
UmaCtfAdapter
Central contract that coordinates between CTF and UMA Oracle
CTF
Framework for creating conditional tokens representing market outcomes
Optimistic Oracle
UMA’s oracle that provides optimistic dispute resolution
Key Contract Elements
TheUmaCtfAdapter contract includes:
- Immutable References: Direct connections to CTF and Optimistic Oracle contracts
- Question Storage: Mapping of
questionIDtoQuestionDatastructs containing market parameters - Oracle Interface: Implementation of
IOptimisticRequesterfor receiving callbacks - Access Control: Admin functionality via the
Authmixin
UmaCtfAdapter.sol
Question Data Structure
Each market is represented by aQuestionData struct:
IUmaCtfAdapter.sol
Resolution Flow
Market Initialization
When a new market is created, the
initialize() function:- Validates the ancillary data and reward token
- Stores market parameters in the
questionsmapping - Calls
ctf.prepareCondition()to prepare the market on CTF - Sends a price request to the Optimistic Oracle
UmaCtfAdapter.sol
Proposal Period
UMA proposers monitor requests and fetch resolution data off-chain. A proposer:
- Stakes the required bond
- Proposes a price (0 for NO, 0.5 ether for UNKNOWN, 1 ether for YES)
- Waits for the liveness period (~2 hours by default)
The liveness period allows disputers to challenge incorrect proposals.
Dispute Handling (First Dispute)
If the proposal is disputed for the first time:
- The
priceDisputed()callback is triggered automatically - The adapter resets the question with a new timestamp
- A fresh price request is sent to the Optimistic Oracle
UmaCtfAdapter.sol
Dispute Handling (Second Dispute)
If disputed again:
- The dispute escalates to UMA’s Data Verification Mechanism (DVM)
- UMA token holders vote on the correct outcome
- Resolution takes 48-72 hours
- The
refundflag is set to return rewards to the creator
Safety Mechanisms
Automatic Reset
On the first dispute, the adapter automatically resets the question:- Prevents malicious or incorrect proposals from stalling resolution
- Ensures a second chance for proposers to provide correct data
- Only happens once per question
Manual Resolution
Admins can flag questions for manual resolution:UmaCtfAdapter.sol
Manual resolution requires a 1-hour safety period to prevent hasty decisions.
Pause/Unpause
Admins can pause resolution to handle edge cases:Price Validation
The adapter enforces strict price validation:UmaCtfAdapter.sol
Special Price: Ignore
If the oracle returnstype(int256).min (the “ignore” price):
- The question is automatically reset
- A new price request is sent
- This allows the oracle to signal that a question needs reconsideration
Integration Points
Conditional Tokens Framework
The adapter interacts with CTF through two key functions:Optimistic Oracle V2
The adapter configures oracle requests with specific settings:UmaCtfAdapter.sol
Constants
UmaCtfAdapter.sol