Consensus Systems
LP-0101: Prediction Markets Framework
| Field | Value |
|---|---|
| LP | 0101 |
| Title | Prediction Markets Framework |
| Author | Lux Core Team |
| Status | Draft |
| Created | 2025-12-31 |
| Category | DeFi Infrastructure |
Abstract
This proposal introduces the Conditional Tokens Framework (CTF) to Lux, enabling prediction markets with UMA oracle resolution. The system allows creation of binary and multi-outcome markets where users can split collateral into outcome tokens, trade positions, and redeem winnings after resolution.
Motivation
Prediction markets provide:
- Price Discovery - Aggregate information about future events
- Hedging - Protect against uncertain outcomes
- Speculation - Trade on beliefs about future events
- Governance - Futarchy-style decision making
The CTF + UMA combination (used by Polymarket) is the most battle-tested prediction market infrastructure.
Specification
Core Contracts
| Contract | Location | Purpose |
|---|---|---|
ConditionalTokens | contracts/prediction/ctf/ | ERC-1155 outcome tokens |
CTHelpers | contracts/prediction/ctf/ | ID generation helpers |
UmaCtfAdapter | contracts/prediction/adapters/ | UMA oracle bridge |
NegRiskAdapter | contracts/prediction/adapters/ | Multi-outcome markets |
Market Lifecycle
┌─────────────────────────────────────────────────────────────────────────┐
│ PREDICTION MARKET LIFECYCLE │
├─────────────────────────────────────────────────────────────────────────┤
│ │
│ 1. CREATION │
│ Admin calls adapter.initialize(ancillaryData, reward, bond, liveness)│
│ → Creates questionID │
│ → Prepares CTF condition (2 outcomes: YES/NO) │
│ → Requests price from UMA OO │
│ │
│ 2. TRADING │
│ Users call ctf.splitPosition(collateral, amount) │
│ → Receives 1 YES + 1 NO token per collateral unit │
│ → Trade on DEX or via CLOB │
│ Users call ctf.mergePositions() │
│ → Return YES + NO tokens → receive collateral │
│ │
│ 3. RESOLUTION │
│ UMA proposer submits outcome (0=NO, 0.5=UNKNOWN, 1=YES) │
│ → If undisputed after liveness: settles │
│ → If disputed: escalates to DVM voting │
│ Admin calls adapter.resolve(questionID) │
│ → Fetches price from OO │
│ → Calls ctf.reportPayouts() │
│ │
│ 4. REDEMPTION │
│ Winners call ctf.redeemPositions() │
│ → Burn winning tokens → receive collateral │
│ │
└─────────────────────────────────────────────────────────────────────────┘
Conditional Tokens (ERC-1155)
Position tokens are ERC-1155 with deterministic IDs:
// Condition ID
conditionId = keccak256(oracle, questionId, outcomeSlotCount)
// Collection ID (uses BN254 curve math)
collectionId = ecAdd(point(keccak256(conditionId, indexSet)), parentCollectionId)
// Position ID (ERC-1155 token ID)
positionId = keccak256(collateralToken, collectionId)
Configurable Bond Amounts
Per user requirement, bonds are configurable per market:
struct BondConfig {
uint256 minBond;
uint256 maxBond;
bool customBondEnabled;
}
// Global default
mapping(bytes32 => BondConfig) public marketBondConfigs;
// Market creators can set custom bonds
function setMarketBondConfig(bytes32 questionID, uint256 minBond, uint256 maxBond) external;
Multi-Outcome Markets (NegRiskAdapter)
For markets with >2 outcomes (elections, sports):
Market: "Who will win the 2024 election?"
├── Question 1: "Will Candidate A win?" → YES/NO tokens
├── Question 2: "Will Candidate B win?" → YES/NO tokens
└── Question 3: "Will Candidate C win?" → YES/NO tokens
Invariant: Only ONE question can resolve to YES
Conversion: 1 NO(A) + 1 NO(B) ≡ 1 USDC + 1 YES(C)
Parameters
| Parameter | Value | Notes |
|---|---|---|
| Outcome Slots | 2-256 | Binary markets use 2 |
| Default Liveness | 7200s | 2 hours |
| Bond Currency | LUSD | Stablecoin |
| Min Bond | 100 LUSD | Configurable |
| Max Bond | 100,000 LUSD | Configurable |
Security Considerations
- Conditional Token Audit: Based on Gnosis CTF (audited)
- Position ID Collision: CTHelpers uses elliptic curve math to prevent
- Oracle Trust: Only designated adapter can report payouts
- Reentrancy: Split/merge use checks-effects-interactions pattern
Cross-Chain Support
Markets can be created on Zoo/Hanzo chains via Warp messaging (see LP-0103):
C-Chain (Hub) Zoo Chain (Spoke)
┌─────────────┐ ┌─────────────┐
│ WarpMarket │◄──Warp────►│ WarpMarket │
│ Hub │ Messaging │ Spoke │
└─────────────┘ └─────────────┘
Implementation
Contracts in ~/work/lux/standard/contracts/prediction/:
ctf/ConditionalTokens.sol- ERC-1155 outcome tokensctf/CTHelpers.sol- Helper libraryadapters/UmaCtfAdapter.sol- UMA bridgelibraries/AncillaryDataLib.sol- Data encodinglibraries/PayoutHelperLib.sol- Payout validation