Flight Markets
Flight delay prediction markets settled by Chainlink CRE with verifiable evidence hashes.
What it is
Flight Markets is a binary prediction market for flight travel delays. Users can buy YES or NO positions on whether a flight will be delayed beyond a defined threshold. Choosing YES can act like parametric insurance cover against major disruption, while NO reflects the view that the flight will remain on time or below the delay threshold. After trading closes, anyone can request settlement onchain. A Chainlink CRE workflow detects the settlement request event, fetches flight status from an external API (AirLabs), deterministically computes the outcome and delay minutes, generates an evidence pack (canonical JSON + keccak256 hash), stores settlement data into Firestore, and submits a signed report back onchain. The smart contract finalizes the market and enables winners to claim payouts, while storing delayMinutes + evidenceHash for auditability.
How it Works
- Solidity (Foundry + OpenZeppelin): FlightMarket.sol implements YES/NO pools, emits SettlementRequested, receives CRE reports in onReport, stores resolved, delayMinutes, evidenceHash, and supports claim().
- Chainlink CRE Workflow (TypeScript): An EVM Log Trigger watches SettlementRequested. The workflow calls AirLabs via CRE’s HTTP capability, uses deterministic rules to compute delayMinutes and a boolean outcome, builds an evidence pack, hashes it, signs a report, and performs an onchain write.
- Frontend (React + Vite + TS + wagmi + rainbowkit + react-query + Tailwind + Recharts): A Polymarket-style chart reconstructs implied probability over time from PositionBought logs (YES/(YES+NO)), with time-range filters and clean loading/empty/error states.
Links
Created by
- Vasco Domingues