Market Resolution & UMA Oracle
Relevant source files
The following files were used as context for generating this wiki page:
- src/lib/direct-resolution.ts
- src/app/api/sync/resolution/route.ts
- src/app/[locale]/(platform)/event/[slug]/_components/DirectResolutionButton.tsx/event/[slug]/_components/DirectResolutionButton.tsx)
- src/app/[locale]/(platform)/event/[slug]/_components/EventRules.tsx/event/[slug]/_components/EventRules.tsx)
- src/app/[locale]/(platform)/event/[slug]/_utils/resolved-order-panel-market.ts/event/[slug]/_utils/resolved-order-panel-market.ts)
- src/lib/uma.ts
The market resolution system facilitates the final settlement of prediction markets by determining winning outcomes and distributing payouts. The platform supports two primary resolution mechanisms: Direct Resolution, where whitelisted proposers submit results, and UMA Oracle, which utilizes UMA’s optimistic oracle and dispute process for decentralized verification.
Sources: src/lib/direct-resolution.ts, src/app/[locale]/(platform)/event/[slug]/_components/EventRules.tsx:288-300
Resolution Mechanisms
Direct Resolution (DRO)
Direct Resolution (DRO) is a streamlined settlement process where specific authorized addresses can propose and finalize market outcomes. This mode is typically used for markets requiring faster settlement or those managed by trusted entities.
- Whitelisting: Proposers must be added to a whitelist by the market creator before they can submit results.
- Oracle Interaction: Uses a dedicated
DirectResolutionOraclecontract to executeproposeAndResolveorproposeAndResolveNegRiskfor negative risk markets. - Reward System: Proposers may earn a reward from a pool if their proposal is confirmed. This requires a bond to be deposited at the time of proposal.
Sources: src/lib/direct-resolution.ts:16-17, 85-115, src/app/[locale]/(platform)/event/[slug]/_components/DirectResolutionButton.tsx:850-860
UMA Optimistic Oracle
The UMA resolution mode leverages UMA's decentralized infrastructure to handle disputes and ensure accuracy through a verification window.
- Liveness Period: After an outcome is proposed, a liveness period (e.g., 7200 seconds) allows for disputes.
- Ancillary Data: Metadata used by UMA to define the specific question and rules for resolvers.
- Dispute Logic: If a proposal is disputed, it moves into a "challenged" or "disputed" state for final review by UMA token holders.
Sources: src/app/api/sync/resolution/route.ts:543-568, src/app/[locale]/(platform)/event/[slug]/_components/EventRules.tsx:32-40
Architecture & Data Flow
Resolution Sync Workflow
The platform uses a background synchronization service to track the on-chain status of resolutions via subgraphs. The sync process updates the local database state, triggers cache invalidations, and settles user payouts.
The synchronization logic handles various statuses including posed, proposed, challenged, and resolved. It also computes resolution deadlines based on livenessSeconds and flagged status.
Sources: src/app/api/sync/resolution/route.ts:117-230, 543-568
Client-Side Resolution Interface
The DirectResolutionButton component manages the UI for both whitelisted resolvers and public proposers.
Key Logic & Constants
Outcome Mapping
Resolutions are mapped to numerical prices representing the certainty of the outcome.
| Outcome | Numerical Price (On-Chain) | Description |
|---|---|---|
| Yes | 1,000,000,000,000,000,000 (1e18) | Resolves the market to the "Yes" outcome. |
| No | 0 | Resolves the market to the "No" outcome. |
| Inconclusive | 500,000,000,000,000,000 (0.5e18) | Splits the payout 50/50 between outcomes. |
Sources: src/lib/direct-resolution.ts:258-266, src/app/api/sync/resolution/route.ts:22-25
Error Handling
The system categorizes resolution failures to provide user-facing feedback during the proposal process.
| Error Scenario | Internal Message | User Feedback |
|---|---|---|
| Insufficient Gas | insufficient funds | "Connected proposer wallet needs POL for gas..." |
| Unauthorized | not whitelisted | "You are not allowed to propose a result..." |
| Market Finalized | already resolved | "This market is already resolved." |
| Contract Inactive | marketnotactive | "Resolution rewards are not available..." |
Sources: src/lib/direct-resolution.ts:269-304
Resolution Rules & Metadata
The EventRules component displays the "Rules & Resolution" section on event pages. It extracts details from market metadata to identify the resolver (e.g., UMA or Chainlink) and provides links to the official resolution source.
- Resolver Gradients: Visual identification of resolvers using generated gradients based on the oracle address.
- Source Verification: Users are required to confirm they have checked the official resolution source URL before submitting a proposal.
- Additional Context: Supports admin-defined additional context and "Updated" timestamps for evolving events.
Sources: src/app/[locale]/(platform)/event/[slug]/_components/EventRules.tsx:28-56, 321-360, 480-495
Inconclusive Results
An "Inconclusive result" (Unknown 50/50) occurs when a market cannot be resolved to either listed outcome according to its rules.
- Logic: Detected when
resolution_priceis 0.5 or when payout numerators are equal (e.g., [1, 1]). - Visuals: Displays an explicit "Inconclusive result" badge and splits rewards equally if applicable.
Sources: src/app/[locale]/(platform)/event/[slug]/_utils/resolved-order-panel-market.ts:285-320, src/app/[locale]/(platform)/event/[slug]/_components/DirectResolutionButton.tsx:1095-1110
Conclusion
The Market Resolution system provides a robust framework for finalizing event outcomes through both automated syncs and manual user interactions. By integrating UMA's optimistic oracle alongside a whitelisted direct resolution path, the platform balances decentralization with efficiency. The implementation ensures data integrity through subgraph-driven background processes and provides whitelisted entities with dedicated on-chain resolution pathways.