Overview
Initializing a market creates a new prediction market question and connects it to UMA’s Optimistic Oracle for resolution. Theinitialize() function atomically:
- Registers the question with the adapter
- Prepares the condition on the Conditional Tokens Framework (CTF)
- Submits a price request to the Optimistic Oracle
Function Signature
UmaCtfAdapter.sol
Parameters
The question data that proposers will use to determine the correct answer. This should be clear, unambiguous, and contain all information needed to resolve the market.Requirements:
- Cannot be empty
- Total length after appending initializer address must not exceed 8,139 bytes (
MAX_ANCILLARY_DATA) - The adapter automatically appends
,initializer:<address>to track the question creator
ERC20 token used for rewards and bonds. Must be whitelisted in UMA’s
CollateralWhitelist.Common options include USDC, USDT, or other stablecoins.Amount of
rewardToken offered to successful proposers.Considerations:- Set to
0for no reward (only final fee applies) - Higher rewards incentivize faster proposals
- Caller must approve the adapter to spend
rewardamount if non-zero
Additional bond required from proposers/disputers beyond the default Optimistic Oracle bond.Considerations:
- Set to
0to use default OO bond - Higher bonds for markets securing larger value
- Acts as a deterrent against incorrect proposals
Challenge period in seconds before a proposal becomes finalized.Considerations:
- Set to
0to use default liveness period (2 hours) - Longer periods for high-value markets (recommended: days for large markets)
- Allows time for disputers to challenge incorrect proposals
Returns
Unique identifier for the question, computed as
keccak256(ancillaryData) after appending the initializer address.Use this ID for all subsequent operations (resolve, pause, etc.)Parameter Selection Guide
Reward Sizing
The reward should incentivize timely proposals while remaining economically efficient:Low Value Markets
Reward: $10-50 USD equivalentSufficient for markets with < $10,000 in volume
High Value Markets
Reward: $100-500+ USD equivalentFor markets securing significant value or requiring rapid resolution
Proposal Bond Sizing
Bonds protect against malicious proposals. Consider the market’s total value:Example Bond Calculation
Liveness Period Selection
Default Liveness (0 / 2 hours)
Default Liveness (0 / 2 hours)
Suitable for:
- Low-value markets
- Time-sensitive events
- Markets with < $10,000 volume
Extended Liveness (1-7 days)
Extended Liveness (1-7 days)
Recommended for:
- High-value markets (> $100,000)
- Complex questions requiring analysis
- Markets where security is paramount
Maximum Liveness (7+ days)
Maximum Liveness (7+ days)
Use for:
- Markets securing millions in value
- Questions requiring extensive verification
- Critical infrastructure markets
Example Usage
Basic Initialization
Basic Market
High-Value Market Initialization
High-Value Market
Zero-Reward Initialization
Minimal Cost Market
State Changes
Wheninitialize() is called, the following occurs:
Validation
- Verifies
rewardTokenis whitelisted - Checks ancillary data is non-empty and within limits
- Ensures question hasn’t been initialized already
Question Storage
Creates
QuestionData struct in storage with:requestTimestamp: Current block timestampcreator:msg.senderancillaryData: Question data with appended initializer- Reward/bond/liveness parameters
CTF Preparation
Calls
ctf.prepareCondition(address(this), questionID, 2) to register a binary outcome conditionError Conditions
The
rewardToken is not whitelisted by UMA’s CollateralWhitelist.Solution: Use a whitelisted token (USDC, USDT, etc.)Either:
- Ancillary data is empty
- Final ancillary data exceeds
MAX_ANCILLARY_DATA(8,139 bytes)
A question with this
questionID already exists.Solution: Each unique ancillary data + initializer combination can only be initialized onceEvents Emitted
Event
Best Practices
Clear Questions
Write unambiguous ancillary data with:
- Specific outcome criteria
- Resolution data source
- Timestamp boundaries
Economic Security
Size rewards and bonds proportional to:
- Expected market volume
- Value at stake
- Resolution urgency
Test Parameters
Start with conservative values:
- Higher bonds
- Longer liveness
- Adequate rewards
Approve Tokens
Always approve token spending before calling
initialize() if reward > 0Next Steps
Resolving Markets
Learn how to check market readiness and resolve questions