Market Lifecycle Overview
A prediction market goes through several distinct phases from creation to settlement. Here’s the complete lifecycle when using delphAI as the resolution oracle.Phase 1: Market Creation
Who: Prediction market platform Duration: One transaction The platform creates a market on delphAI by paying the creation fee:- Question: The event to predict
- Description: Additional context and resolution criteria
- Outcomes: Array of possible results (e.g., [“Yes”, “No”])
- Resolution Time: When delphAI AI will resolve
- Creates and stores the market
- Schedules AI agent for resolution time
- Emits
MarketCreated
event - Returns unique market ID
Market is now created on delphAI and scheduled for automatic AI resolution
Phase 2: Active Trading
Who: Users on the platform Duration: From creation to close time Users trade on your platform while the market is on delphAI:User Actions:
- Buy YES/NO positions
- Sell positions
- Provide liquidity
- Monitor prices
Platform Responsibilities:
- Execute trades
- Update odds/prices
- Handle deposits/withdrawals
- Display market info
- Poll delphAI for market status
Checking Market Status:
delphAI’s Role:
Waiting - delphAI market is Open, waiting for resolution time
Market Status Tracking
Timestamp | delphAI Status | Platform Action |
---|---|---|
Before closeTime | Open | Allow trading |
At closeTime | Open | Stop trading on platform |
Between close & resolution | Open | Wait for delphAI resolution |
After resolution | Resolved | Distribute winnings |
Phase 3: Market Close
Who: Platform (managed separately from delphAI) Duration: Instant Your platform closes trading before delphAI resolves:- No new bets allowed on your platform
- Positions are locked
- Market awaits delphAI resolution
- Users can view their positions
Gap between platform close time and delphAI resolution allows for:
- Events to complete (e.g., game ends)
- Data to be available (e.g., official results published)
- AI to fetch accurate information
Phase 4: AI Resolution
Who: delphAI resolver (automatic) Duration: Seconds to minutes At the scheduled resolution time, delphAI’s AI resolver activates:1
Trigger
When block.timestamp reaches resolutionTimestamp, delphAI’s resolver can resolve the market
2
AI Execution (Offchain)
AI agent performs resolution:
- Parse question and description (criteria)
- Query specified data sources
- Fetch relevant data
- Analyze against criteria
- Determine winning outcome
- Generate resolution explanation
3
Onchain Submission
Resolver calls delphAI contract:
4
Platform Queries Resolution
Your platform checks for resolution:
- outcomeIndex: Index of winning outcome in possibleOutcomes array
- resolutionData: AI’s explanation of the resolution
- proofData: TEE attestation (future feature)
- resolvedAt: Timestamp when resolved
- resolvedBy: Address of the resolver
Phase 5: Settlement
Who: Platform + Users Duration: Ongoing (users claim when ready) After delphAI resolves, the platform handles payouts:Platform Calculates Winnings:
Users Claim:
delphAI’s role is complete - market is resolved on delphAI, platforms query the result and handle payouts
Phase 6: Archived
Who: Platform Duration: Permanent Market is permanently resolved and archived: What’s Available:- ✅ Historical data viewable on delphAI
- ✅ Resolution details preserved
- ✅ Trade history accessible on platform
- ✅ AI explanation permanently stored
- ❌ No further actions possible
Timeline Example
Real-world example: “Will Lakers win vs Warriors on Feb 15, 2025?”State Transitions
delphAI Market States:
delphAI has 3 market states:- Open: Market created, waiting for resolution time
- Resolved: AI has resolved the market
- Cancelled: Market was cancelled before resolution
Platform-Side States:
Your platform manages its own states separately:- Trading Open: Users can place bets
- Trading Closed: Bets closed, waiting for delphAI resolution
- Distributing: delphAI resolved, calculating payouts
- Settled: Payouts complete
- Archived: Market finished
Error States:
Edge cases that platforms must handle:
-
Resolution Delay: Resolver hasn’t resolved yet
- Action: Wait or have backup manual resolution
-
Data Source Unavailable: APIs down during resolution
- Action: Resolver uses fallback sources or delays
-
Market Cancelled: Market cancelled on delphAI
- Action: Return all bets to users
-
Query Failure: Can’t read delphAI market
- Action: Retry queries, handle RPC failures