Smart Contracts
ResolutionEngine
Contract responsible for resolving markets via oracle, manual, or VRF methods
ResolutionEngine
ResolutionEngine is the judge of OracleMart — it determines market outcomes (YES/NO) using multiple resolution methods while preventing manipulation and ensuring auditability.
Overview
- Determines market outcomes
- Supports multiple resolution methods
- Provides consensus and emergency procedures
- Isolates decision logic from market/betting flow
Resolution Methods
1) Manual (Commit → Reveal)
Purpose: prevents front‑running and manipulation for subjective markets.
Commit steps:
- Resolver decides outcome (YES/NO)
- Submits commitment hash of decision + secret salt
- Waits a timelocked period
Reveal steps:
- Reveals outcome + salt
- Contract verifies hash
- Outcome finalized
2) Oracle (Automated)
Single oracle flow:
- Market ends
- Oracle fetches price from Chainlink
- Compares to threshold/condition
- Submits result → finalize
Multi‑oracle consensus:
- Multiple oracle submissions
- Weighted aggregation
- Threshold (for example 51 percent) reached → finalize
Validation:
- Freshness window (data must be recent)
- Deviation limits (reject anomalous prices)
- Approved feed sources only
3) VRF (Random)
Provably fair randomness for gaming‑style markets via Chainlink VRF.
Flow:
- Request random number
- Receive proof and value
- Map number to outcome
Roles
- Resolver (creator for manual markets): commits and reveals
- Oracle providers: submit data, participate in consensus
- Emergency admin: circuit breaker and emergency resolution
- System admin: oracle configuration, thresholds, pause
Oracle Consensus (example)
Weight‑based voting:
Oracle A: 40% YES
Oracle B: 35% YES
Oracle C: 25% NO
Total YES: 75% → consensus reachedKey parameters:
- Minimum oracles
- Consensus threshold (percent)
- Max allowed deviation (percent)
- Response timeout
Emergency Procedures
Circuit breaker triggers on:
- Excessive deviation
- Stale/failed feeds
- No consensus
Effects:
- Pause resolution
- Require admin review or emergency resolve
Timeout handling:
- If commit‑reveal not completed in time → emergency path
- Oracle unavailability → manual admin resolution
Data Flows
Manual:
Commit → Wait → Reveal → Verify → FinalizeOracle:
End → Fetch price → Validate → Consensus → FinalizeVRF:
End → Request VRF → Receive proof → Compute → FinalizeSecurity
- Commit‑reveal with salted hashes
- Multi‑source oracles with weights
- Deviation and staleness checks
- Reentrancy guards and pause
On-chain (Sepolia)
{
address: "0xdD2DBd78d4D260321735d45EF32Df965c962Ab7F"
}