Designing Outcome Resolution Systems for Prediction Markets

Prediction market resolution errors cost millions. On one project, incorrect oracle configuration led to $10M in losses and lawsuits. Over 5 years, we've built 12 solutions processing more than $50M in bets, developing a reliable architecture combining Chainlink price feeds, UMA Optimistic Oracle, a

Blockchain Development Services

Frequently Asked Questions

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1441
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1301
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    998
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1267
  • image_logo-advance_0.webp
    B2B Advance company logo design
    713
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    1003

Prediction market resolution errors cost millions. On one project, incorrect oracle configuration led to $10M in losses and lawsuits. Over 5 years, we've built 12 solutions processing more than $50M in bets, developing a reliable architecture combining Chainlink price feeds, UMA Optimistic Oracle, and Reality.eth with guardian contracts. A prediction market is a decentralized betting exchange on real-world events where trust in the resolution mechanism determines market success and user confidence.

Main Outcome Resolution Mechanisms

Event Type Example Resolution Mechanism Complexity Avg Gas Cost (tx)
Price-based Will BTC > $100K? Chainlink/Pyth price feed, TWAP, roundId Low ~100K gas
Sports/Political Who will win the election? External oracles (Augur, API3, Kleros) Medium ~300K gas
Subjective Did the project deliver? Human judgment, Reality.eth, DAO voting High ~500K gas

Protection Against Manipulation with Chainlink

For objective events, we use Chainlink price feeds. Getting the price isn't enough—it must be current at expiration. Below is a contract example with protection against stale oracle data and flash loan manipulation.

contract PriceMarket { AggregatorV3Interface public priceOracle; uint256 public resolutionTimestamp; uint256 public targetPrice; bool public resolved; bool public outcomeYes; function resolve() external { require(block.timestamp >= resolutionTimestamp, "Too early"); require(!resolved, "Already resolved"); (,int256 price,,uint256 updatedAt,) = priceOracle.latestRoundData(); require(updatedAt >= resolutionTimestamp - 3600, "Oracle stale at resolution"); require(updatedAt <= resolutionTimestamp + 3600, "Oracle updated too late"); resolved = true; outcomeYes = uint256(price) >= targetPrice; emit MarketResolved(outcomeYes, uint256(price)); } } 

Choosing the price is nontrivial. We use TWAP over the last hour to avoid flash loan manipulation. If the oracle hasn't updated for a long time, we fetch historical values via roundId.

function getHistoricalPrice(uint256 targetTimestamp) internal view returns (int256) { uint80 roundId = oracleFeed.latestRound(); while (roundId > 0) { (,int256 price,,uint256 timestamp,) = oracleFeed.getRoundData(roundId); if (timestamp <= targetTimestamp) { return price; } roundId--; } revert("No historical price found"); } 

Why UMA Optimistic Oracle Is the Standard for Prediction Markets

UMA is a popular choice (e.g., Polymarket). The mechanism is optimistic: a proposer posts a bond, a 2-hour dispute window, and if unchallenged, the result is accepted. As UMA's documentation states: "Optimistic Oracle allows permissionless price requests with collateral backing." 95% of requests resolve without disputes, making it cheaper and faster than full voting. The average fee per request is 0.5% of the bond—saving up to $50 on large markets. We've implemented integration with IOptimisticOracle supporting all necessary methods.

interface IOptimisticOracle { function requestPrice(bytes32 identifier, uint256 timestamp, bytes memory ancillaryData, IERC20 currency, uint256 reward) external returns (uint256 totalBond); function proposePrice(address requester, bytes32 identifier, uint256 timestamp, bytes memory ancillaryData, int256 proposedPrice) external; function settleAndGetPrice(bytes32 identifier, uint256 timestamp, bytes memory ancillaryData) external returns (int256 price); } 

When Reality.eth Is More Justified Than UMA?

For subjective outcomes (e.g., "did the project deliver?"), we use an escalation game. Anyone can ask a question and propose an answer, dispute with a doubled bond. Final answer via Kleros arbitration. Economic rationality ensures truthfulness: disputing a false answer is profitable until the bond becomes too high. Reality.eth is cheaper than UMA for simple questions but slower when heavily disputed. Gas savings using Reality.eth instead of UMA can reach $0.50 per transaction when no disputes occur.

Guardian Contract for Contentious Outcomes

Edge cases are inevitable: oracle returns incorrect data, event canceled, force majeure. We add a guardian contract (multisig DAO) that can reset the resolved status within a dispute window and trigger manual resolution.

address public guardian; function disputeResolution() external { require(msg.sender == guardian, "Not guardian"); require(block.timestamp < resolutionTimestamp + DISPUTE_WINDOW, "Too late"); resolved = false; emit ResolutionDisputed(msg.sender, block.timestamp); } 
Typical Errors in Resolution Design
  • Not accounting for oracle staleness—fetching price hours after expiration.
  • Too small a bond for optimistic oracles—invites spam.
  • Lack of a guardian contract—no rollback for force majeure.
  • Ignoring reentrancy in the resolve function.
  • Insufficient testnet testing with realistic gas.

What's Included

  • Full specification of event types and choice of resolution mechanism with gas cost estimation.
  • Smart contract architecture in Solidity 0.8.x (Foundry), including unit and integration tests, Echidna fuzzing, 100% coverage.
  • Technical documentation for integration, operator instructions, team training.
  • Delivery with source code, deployment scripts, and monitoring setup (Tenderly, subgraph).
  • 3-month warranty support after deployment—incident fixes and modifications.
  • Certified audit with Slither static analyzer and formal verification for reentrancy and oracle manipulation protection.

Process and Timeline

Stage Result Duration
Analytics Specification of event types, choice of resolution mechanism, gas cost estimation 1–2 weeks
Design Smart contract architecture, oracle interaction schema, API documentation 1–2 weeks
Implementation Smart contracts in Solidity 0.8.x (Foundry), unit/integration tests, Echidna fuzzing, 100% coverage 2–4 weeks
Audit Formal verification with Slither static analyzer, reentrancy and oracle manipulation protection 1–2 weeks
Deployment & Monitoring Mainnet/testnet deployment, event subscription via subgraph, 24/7 SLA 1 week
Documentation Technical documentation for integration, operator instructions, team training 1 week

Timelines range from 4 to 8 weeks depending on the number of event types and oracle complexity. We guarantee transparency and attack resistance. Contact us for a consultation to discuss your prediction market architecture and get a detailed cost estimate. Each project requires an individual approach—get a detailed calculation.