Skip to content

joinQuantish/quantish-oracle

Repository files navigation

Quantish Oracle

AI-powered cross-platform prediction market resolution on Chainlink CRE

Quantish Oracle aggregates data from Polymarket, Kalshi, and Limitless to create, monitor, and resolve prediction markets using Chainlink's decentralized oracle network with AI-assisted settlement.

Architecture

                    ┌─────────────────────────────────────────────┐
                    │           Chainlink DON (CRE)               │
                    │                                             │
  HTTP Request ───► │  ┌──────────────────┐                      │
  "Create market"   │  │  Market Creator   │ ─── DON Report ───► │ ──► QuantishOracle.sol
                    │  │  (HTTP Trigger)   │     (create market)  │     on Sepolia
                    │  └──────────────────┘                      │
                    │                                             │
  Every 5 min ────► │  ┌──────────────────┐                      │
  (Cron)            │  │ Price Aggregator  │ ─── DON Report ───► │ ──► _updatePriceFeed()
                    │  │  (Cron Trigger)   │     (0x02 prefix)   │     Cross-platform prices
                    │  └──────────────────┘                      │
                    │                                             │
  SettlementReq ──► │  ┌──────────────────┐   ┌──────────┐      │
  (on-chain event)  │  │ Market Resolver   │──►│ Gemini AI │     │
                    │  │  (Log Trigger)    │◄──│ + Search  │     │ ──► _settleMarket()
                    │  └──────────────────┘   └──────────┘      │     AI-powered resolution
                    └─────────────────────────────────────────────┘
                                                    │
                              ┌──────────────────────┼──────────────────────┐
                              ▼                      ▼                      ▼
                        Polymarket              Kalshi                Limitless
                        (CLOB API)          (DFlow/Solana)          (Base L2)

Demo

What It Does

  1. Market Creator (HTTP Trigger) - Creates on-chain prediction markets from any question. Encodes the question, generates a DON-signed report, and writes it to the QuantishOracle contract.

  2. Price Aggregator (Cron Trigger) - Every 5 minutes, reads on-chain market data and aggregates YES prices from Polymarket, Kalshi, and Limitless. Detects cross-platform arbitrage opportunities (>5% spread). Writes price feeds via DON consensus.

  3. Market Resolver (Log Trigger) - Listens for SettlementRequested events. Reads the market question from the contract, fetches cross-platform price data, queries Gemini AI with Google Search grounding for real-world verification, and writes the settlement outcome (YES/NO + confidence score) via DON-signed report.

How It's Different

Existing prediction market oracles use single-source price feeds. Quantish Oracle is the first to:

  • Aggregate across 3 platforms (Polymarket, Kalshi, Limitless) for cross-platform consensus
  • Use AI with real-time search (Gemini + Google Search) for event verification before settlement
  • Detect arbitrage between platforms as a signal for market health
  • Store cross-platform price feeds on-chain for transparency and composability

Smart Contract

QuantishOracle.sol extends a base prediction market with:

  • Report routing via prefix bytes: no prefix = create market, 0x01 = settle, 0x02 = update price feed
  • PriceFeed struct storing per-market prices from each platform with timestamps
  • Cross-platform settlement requiring both AI confidence and platform price consensus

Tech Stack

  • Chainlink CRE (Runtime Environment) - TypeScript workflows compiled to WASM, running on Chainlink DONs
  • Solidity (0.8.24) - Smart contracts with OpenZeppelin, compiled via Foundry
  • Gemini AI (2.0 Flash via OpenRouter) - AI-powered market resolution
  • Quantish Discovery API - Cross-platform market data aggregation
  • Sepolia Testnet - Ethereum testnet deployment

Project Structure

quantish-oracle/
├── contracts/
│   └── src/
│       ├── QuantishOracle.sol          # Main contract
│       └── interfaces/
│           ├── IReceiver.sol           # CRE receiver interface
│           └── ReceiverTemplate.sol    # CRE receiver base
├── market-creator/                     # Workflow 1: HTTP → Create Market
│   ├── main.ts                         # Entry point (HTTP trigger)
│   ├── httpCallback.ts                 # Handler logic
│   ├── workflow.yaml                   # CRE workflow config
│   └── config.staging.json             # Staging chain config
├── price-aggregator/                   # Workflow 2: Cron → Price Feed
│   ├── main.ts                         # Entry point (Cron trigger)
│   ├── cronCallback.ts                 # Handler logic
│   ├── workflow.yaml                   # CRE workflow config
│   └── config.staging.json             # Staging chain config
├── market-resolver/                    # Workflow 3: Log → AI Settlement
│   ├── main.ts                         # Entry point (Log trigger)
│   ├── logCallback.ts                  # Handler logic
│   ├── gemini.ts                       # AI integration (OpenRouter)
│   ├── workflow.yaml                   # CRE workflow config
│   └── config.staging.json             # Staging chain config
├── project.yaml                        # CRE project settings
├── secrets.yaml                        # Secret mappings
└── .env.example                        # Environment template

Quick Start

Prerequisites

Setup

# Clone
git clone https://github.com/joinQuantish/quantish-oracle.git
cd quantish-oracle

# Configure
cp .env.example .env
# Edit .env with your private key and OpenRouter API key

# Install dependencies
cd market-creator && bun install && cd ..
cd price-aggregator && bun install && cd ..
cd market-resolver && bun install && cd ..

# Authenticate CRE
cre login

# Compile contracts
cd contracts && forge build && cd ..

Deploy Contract

cd contracts
forge create --rpc-url <YOUR_RPC_URL> \
  --private-key <YOUR_KEY> \
  --broadcast \
  src/QuantishOracle.sol:QuantishOracle \
  --constructor-args <FORWARDER_ADDRESS>

Update config.staging.json in each workflow with the deployed contract address.

Simulate Workflows

# Market Creator - create a new prediction market
cre workflow simulate ./market-creator \
  --non-interactive --trigger-index 0 \
  --http-payload '{"question":"Will Bitcoin reach 150k by end of 2026?"}'

# Price Aggregator - fetch cross-platform prices
cre workflow simulate ./price-aggregator \
  --non-interactive --trigger-index 0

# Market Resolver - requires a SettlementRequested event tx hash
cre workflow simulate ./market-resolver \
  --non-interactive --trigger-index 0 \
  --evm-tx-hash <TX_HASH> --evm-event-index 0

Hackathon Tracks

  • Prediction Markets ($16K / $10K / $6K) - Cross-platform aggregation oracle
  • CRE & AI ($17K / $10.5K / $6.5K) - Gemini AI-powered market resolution
  • Tenderly ($2K / $1K / $500) - Virtual TestNet deployment

About Quantish

Quantish is an AI-powered prediction market infrastructure platform. We build MCP servers, trading agents, and aggregation tools for Polymarket, Kalshi, and Limitless.

License

MIT

About

AI-powered cross-platform prediction market resolution on Chainlink CRE. Aggregates Polymarket, Kalshi, Limitless data with Gemini AI settlement. Built for Chainlink Convergence Hackathon 2026.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors