OmniSentinel
AI-powered cross-chain DeFi Risk Intelligence/Circuit Breaker & Prediction Market Protocol via Chainlink CRE
What it is
OmniSentinel is a fully automated risk intelligence protocol for DeFi. It solves a problem that has cost users billions: there is no trustless, on-chain system that continuously monitors protocol health across chains, scores risk using real AI inference, and takes automated protective action without a human in the loop.
OmniSentinel does all three. Four Chainlink CRE workflows run continuously. One monitors live TVL and reserve data from protocols like Aave, Compound, and Lido via DeFi Llama, feeds it to Gemini AI for risk scoring, and writes structured risk scores on-chain to a RiskOracle contract every 5 minutes. A second workflow listens for on-chain EVM log events from the PredictionMarket contract and uses Gemini to autonomously settle prediction markets on DeFi safety outcomes without no human arbitration. A third workflow checks reserve ratios every minute and triggers a SafeguardController circuit breaker if thresholds are breached, pausing protocol interactions before damage compounds. A fourth confidential workflow aggregates sensitive risk data via CRE's private HTTP feature without exposing raw inputs on-chain. A fourth confidential workflow uses CRE's encrypted HTTP capability and trusted execution environment to aggregate sensitive portfolio risk data without exposing raw positions or API credentials on-chain. Only the aggregate score is published.
Users interact through a Next.js frontend with thirdweb wallet integration, take YES/NO positions on safety prediction markets, and must verify via World ID to prevent sybil attacks on market outcomes. All contracts are deployed and battle-tested on a Tenderly Virtual TestNet forked from Sepolia, with 80+ on-chain transactions across 34 RiskOracle updates, 7 prediction markets, 8 circuit breaker transitions, and 4 World ID verifications already on record. [A more technical version is in the repo]
How it Works
The core execution layer is four Chainlink CRE workflows written in TypeScript, each with a config and a main.ts entry point. RiskMonitorWorkflow uses a cron trigger (every 5 minutes), calls DeFi Llama's API for live TVL data, constructs a structured prompt for Gemini, parses the scored JSON response, and writes the result on-chain via a CRE→IReceiver→RiskOracle call. MarketSettlerWorkflow uses an EVM Log trigger on PredictionMarket contract events. When a market's resolution window closes, CRE fires the workflow, Gemini evaluates the outcome, and the settlement report is committed on-chain. SafeguardTriggerWorkflow is a 1-minute cron that monitors reserve ratios and calls SafeguardController.triggerBreaker() when thresholds are exceeded. PrivateRiskMonitorWorkflow uses CRE's confidential HTTP capability to aggregate sensitive data without on-chain exposure.
The four Solidity contracts (RiskOracle, PredictionMarket, SafeguardController, WorldIDVerifier) all implement the IReceiver interface for CRE message delivery. Contracts are compiled with Foundry and deployed via a Deploy.s.sol script. WorldIDVerifier integrates the World ID on-chain proof verification standard to gate prediction market participation. The frontend is Next.js with thirdweb's ConnectButton, useReadContract, and useSendTransaction hooks, DeFi Llama API routes for live data, and World ID IDKit for the verification widget. Tenderly is used both for deployment and for a public explorer judges can use to verify every transaction. [A more technical version is in the repo.]
Links
Created by
- Yash Patil
- Ashmit Sethi