AI-Powered DeFi Risk Oracle | Chainlink Convergence Hackathon 2026
Institutional-grade early warning system providing 24-72 hour advance notice before major DeFi collapses. Powered by 5 Chainlink services with multi-AI consensus scoring.
DeFi protocols managing tens of billions in TVL have no on-chain early warning system for systemic risk. When cascading liquidations hit β as in the Terra/Luna collapse (May 2022), FTX contagion (Nov 2022), and Euler hack (Mar 2023) β individual protocols have minutes to react, not days. There is no primitive that monitors cross-protocol contagion, stablecoin depeg risk, and AI-scored threat level simultaneously and exposes the result on-chain so any smart contract can read it.
DeRisk Protocol is an on-chain risk oracle that runs a 5-step assessment pipeline every 5 minutes via Chainlink CRE:
- Fetches live TVL across Aave V3, Compound V3, and MakerDAO from DeFi Llama
- Reads the live ETH/USD price from a Chainlink Price Feed on Sepolia
- Runs a cross-protocol contagion cascade simulation (empirical correlation matrix: AaveβCompound 0.87)
- Scores aggregate risk via multi-AI consensus: Claude AI (50%), rule-based (30%), contagion-adjusted (20%)
- Writes the final risk score, TVL snapshot, and circuit breaker state to
DeRiskOracle.solon Sepolia
Any DeFi protocol integrates in 5 lines of Solidity. SimpleLendingPool demonstrates auto-pause when risk β₯ 70/100; RiskAwareVault demonstrates dynamic LTV that scales continuously with risk. Historical backtesting against 4 real events shows an average 2.3-day advance warning.
CRE is the only component that makes this oracle possible. Every step runs inside the Chainlink Runtime Environment:
HTTPClient+ConsensusAggregationByFieldsβ fetches TVL from DeFi Llama across all DON nodes and takes the median, preventing any single node from manipulating inputsEVMClientβ reads the Chainlink Price Feed (latestRoundData) directly from Sepolia at a finalized block, so the price is tamper-proofConfidentialHTTPClient(AI call) β sends the enriched prompt to Anthropic Claude API viaconfidential-http@1.0.0-alpha; the API key ({{.anthropicApiKey}}) is vault-managed and never in plaintext; response is AES-256-GCM encrypted in the TEE enclave (encryptOutput: true) and decrypted in-workflow usingruntime.getSecret("san_marino_aes_gcm_encryption_key"); in simulation the call succeeds but AES decryption is skipped (AES key absent from staging secrets / no TEE), falling back to rule-based scoringwriteReport()β generates a cryptographically signed consensus report and writes it toDeRiskOracle.solviaIReceiver.onReport(); no trusted intermediary requiredruntime.getSecret()β retrieves the AES-256-GCM decryption key from CRE secrets (VaultDON in production) to decrypt the confidential Anthropic response in-workflow; all secret identifiers are declared insecrets.yaml, none committed to git
The CRE cron trigger fires every 5 minutes. Without CRE, achieving DON-level consensus on multi-source off-chain data and writing it on-chain with cryptographic attestation would require building a custom oracle network from scratch.
Demo: Watch the full walkthrough on YouTube
DeRisk Protocol monitors systemic risk across major DeFi protocols in real-time:
- Multi-Protocol Monitoring β Tracks TVL across Aave V3, Compound V3, and MakerDAO via DeFi Llama
- Chainlink Price Feed β Reads live ETH/USD from Chainlink oracle on Sepolia
- Contagion Analysis β Cascade simulation with empirical correlation matrix across protocols
- Stablecoin Depeg Detection β Early warning system for USDT, USDC, and DAI peg deviations
- Multi-AI Consensus Scoring β 3 independent models (Claude AI, rule-based, contagion-adjusted) with weighted median
- On-Chain Circuit Breaker β Automatic alerts when aggregate risk exceeds 80/100
- Historical Backtesting β Algorithm validated against 4 real DeFi disasters, proofs stored on-chain
[DeFi Llama] β [CRE Workflow] β [AI Consensus] β [DeRiskOracle.sol] β [Dashboard]
TVL Data 5-step pipeline 3 models vote On-chain write Real-time UI
| Step | Action | Chainlink Service |
|---|---|---|
| 1 | Fetch multi-protocol TVL (HTTP GET x3) | CRE HTTPClient |
| 2 | Read ETH/USD price (EVM Read) | Price Feeds |
| 3 | Contagion cascade + depeg monitoring | CRE |
| 4 | AI consensus scoring (Confidential HTTP) | CRE ConfidentialHTTPClient |
| 5 | Write risk + contagion data on-chain | CRE writeReport / Automation |
| Service | Usage |
|---|---|
| CRE | Orchestrates entire 5-step risk assessment pipeline |
| Price Feeds | Live ETH/USD from Chainlink oracle on Sepolia |
| Data Streams | Real-time DeFi metrics via external API integration |
| Automation | Staleness monitoring, auto-escalation after 10 min |
| Functions | Fallback scoring on DON when AI API is unavailable |
Algorithm applied retroactively to historical market data from 4 major events. Results stored immutably on-chain as BacktestProof records.
| Event | Date | Alert Lead Time | Est. Savings* | Effectiveness |
|---|---|---|---|---|
| Terra/Luna Collapse | May 2022 | 2 days | $30.0B | 50% |
| FTX/Alameda Contagion | Nov 2022 | 3 days | $4.0B | 50% |
| Euler Finance Hack | Mar 2023 | 3 days | $98.5M | 50% |
| Curve Pool Exploit | Jul 2023 | 1 day | $17.5M | 25% |
4/4 events detected. Average 2.3 days early warning.
*Estimated savings assume governance acted on alerts to reduce exposure. Historical backtesting uses TVL and price data from DeFi Llama and Chainlink feeds. Results do not guarantee future performance. See docs/BACKTESTING.md for full methodology.
DeRiskOracle on Sepolia: 0xbC75cCB19bc37a87bB0500c016bD13E50c591f09
Two deployed contracts demonstrate composability β different integration patterns for different use cases.
Contract: 0x942a20CF83626dA1aAb50f1354318eE04dF292c0
Use Case: Binary protection β auto-pauses all deposits/borrows when systemic risk β₯ 70/100.
SimpleLendingPool: 0x942a20CF83626dA1aAb50f1354318eE04dF292c0
Live integration showing how DeFi protocols use DeRisk for protection:
- Auto-pause when systemic risk β₯ 70/100 (
whenSafemodifier on everydepositandborrow) - Circuit breaker integration β reverts if oracle circuit breaker is active
- Real-time risk monitoring β anyone can call
checkRiskAndPause()to lock the pool at risk β₯ 80 - 200% overcollateralized borrowing with collateral-ratio enforcement
What This Proves: If deployed before the Terra collapse (May 2022), this contract would have automatically paused deposits and borrows 48 hours before the crash β protecting user funds from contagion that reached 87/100 on our risk scale.
// SimpleLendingPool reads DeRiskOracle on every state-changing call
modifier whenSafe() {
require(!emergencyPaused, "Pool: emergency paused");
require(!oracle.circuitBreakerActive(), "Pool: circuit breaker active");
require(oracle.riskScore() < 70, "Pool: risk score too high");
_;
}
function deposit(uint256 amount) external whenSafe { ... }
function borrow(uint256 amount) external whenSafe { ... }MockUSDC (test token): 0xAd714Eb7B95d3De5d0A91b816e0a39cDbE5C586B
Contract: 0x016B459747B34b3d24Ea4e3a5aBb7095a58C8287
Use Case: Continuous risk adjustment β dynamically scales max LTV based on live systemic risk score. No binary pause; risk is a dial, not a switch.
| Risk Score | LTV | Regime |
|---|---|---|
| 0β20 | 75% | Normal operations |
| 20β40 | ~66% | Reduce new positions |
| 40β60 | ~57% | Conservative mode |
| 60β80 | ~48% | High caution |
| 80+ | 40% | Floor (circuit breaker zone) |
// RiskAwareVault reads live risk on every deposit
function getCurrentMaxLTV() public view returns (uint256 maxLtvBps) {
uint256 risk = deRiskOracle.riskScore();
if (risk >= 80) return 4000; // 40% floor
uint256 reduction = (risk * 4375) / 1000; // 43.75 bps per risk point
return 7500 - reduction; // linear decrease from 75%
}What This Proves: Two completely different integration patterns β binary circuit breaker vs. continuous parameter adjustment β both reading the same DeRisk oracle. Any DeFi primitive can compose with this.
interface IDeRiskOracle {
function riskScore() external view returns (uint256);
function circuitBreakerActive() external view returns (bool);
function protocolScores(string calldata) external view returns (uint256);
function contagionScore() external view returns (uint256);
}
contract MyDeFiProtocol {
IDeRiskOracle oracle = IDeRiskOracle(0xbC75cCB19bc37a87bB0500c016bD13E50c591f09);
modifier whenSafe() {
require(oracle.riskScore() < 80, "Risk too high");
require(!oracle.circuitBreakerActive(), "Circuit breaker active");
_;
}
function deposit() external whenSafe {
// Protected by DeRisk Oracle
}
}| Function | Description |
|---|---|
getRiskData() |
Full risk assessment (score, TVL, ETH price, timestamp) |
getProtocolScores() |
Per-protocol risk breakdown (Aave, Compound, Maker) |
getProtocolTvls() |
Per-protocol TVL data |
getAggregateScore() |
Weighted average: Aave 50%, Compound 25%, Maker 25% |
getContagionData() |
Cascade risk score and worst-case loss estimate |
circuitBreakerActive() |
True when aggregate score > 80 |
checkUpkeep() / performUpkeep() |
Chainlink Automation staleness monitoring |
backtestResults(index) |
On-chain backtest proof records |
DeRisk uses Chainlink Runtime Environment to orchestrate a 5-step risk assessment pipeline:
| Step | Action | CRE Service | Data Source |
|---|---|---|---|
| 1 | Fetch multi-protocol TVL | HTTPClient | DeFi Llama API (Aave, Compound, Maker) |
| 2 | Read ETH/USD price | EVMClient | Chainlink Price Feed (Sepolia) |
| 3 | Contagion cascade simulation | Internal | Correlation matrix (0.87 AaveβCompound) |
| 4 | Multi-AI consensus scoring | HTTPClient (ConfidentialHTTPClient in production) | Anthropic Claude API |
| 5 | Write risk data on-chain | writeReport() | DeRiskOracle.sol |
# From project root β install workflow dependencies first
cd derisk-workflow && bun install && cd ..
# Run simulation (uses live Chainlink Price Feed + DeFi Llama)
cre workflow simulate ./derisk-workflow --non-interactive --trigger-index 0 -T staging-settingsEvidence: View simulation output
- HTTPClient β Public data from DeFi Llama + AI scoring (simulation)
- ConfidentialHTTPClient β AI calls in production, executed inside TEE enclave via VaultDON
- EVMClient β Read Chainlink Price Feeds
- writeReport() β On-chain risk score updates
- ConsensusAggregation β Multi-model weighted median
- runtime.getSecret() β Anthropic API key from CRE secrets, never in committed config
DeRisk is designed for institutional use with robust failure handling:
| Failure Point | Detection | Fallback Behavior | Safe Default |
|---|---|---|---|
| DeFi Llama API Down | HTTP timeout (10s) | Use cached TVL data (max 1h old) | Elevate risk score +10 |
| Chainlink Price Feed Stale | Timestamp check (>1h) | Fetch backup feed or halt scoring | Mark as stale, no new scores |
| Anthropic API Error | API 5xx response | Use rule-based model only (30% weight β 60%) | Conservative risk estimate |
| CRE Workflow Fails | Runtime exception | Retry 3x with exponential backoff | Alert via Chainlink Automation |
| Contagion Model Error | Division by zero, invalid matrix | Skip contagion component | Use TVL + Depeg only |
- Fail-Safe (Default): When in doubt, elevate risk score β protects users
- Fail-Open (Configurable): For testing environments only
- Chainlink Automation monitors staleness (>10 min) via
checkUpkeep()/performUpkeep() - Circuit breaker auto-activates if risk > 80/100 or data confidence is insufficient
- Consumer contracts inherit failure protection automatically via
whenSafe()modifier β no risk of unprotected state
Stored Immutably:
- Risk scores (
uint256, timestamped per assessment) - Protocol TVL snapshots (per-protocol breakdown: Aave, Compound, Maker)
- ETH/USD price at assessment time
- Contagion scores and cascade estimates
- Backtest proof records (4 historical events)
- Consumer contract pause states
Verifiable Actions:
- Circuit breaker activation (when risk > 80)
- Consumer contract auto-pause triggers
- Governance decisions based on risk thresholds
Etherscan Evidence:
- Every risk update: View event logs
- SimpleLendingPool pause: View contract state
Not Stored On-Chain:
- Raw API responses from DeFi Llama
- Individual AI model prompts and responses
- Intermediate contagion calculations
Why This Is Acceptable:
- Risk monitoring requires real-time external data (TVL, prices) β impossible to fully on-chain
- AI consensus adds qualitative analysis impossible to encode purely on-chain
- All final decisions (risk scores, circuit breaker) are on-chain and fully auditable
- CRE provides cryptographic attestation of off-chain compute integrity
Verification Path:
- View on-chain risk score via Etherscan or
cast call - Reproduce CRE workflow locally with same inputs (
cre workflow simulate .) - Compare results (deterministic except the AI component)
- AI component uses weighted median β outliers don't dominate final score
This hybrid model is standard for oracle networks: external data β consensus β on-chain finality.
How DeRisk Fits:
- Automated Risk Monitoring: Real-time tracking across Aave V3, Compound V3, MakerDAO
- Protocol Safeguard Triggers: SimpleLendingPool auto-pauses at risk > 70/100
- Circuit Breaker Integration: Emergency protection when systemic risk reaches 80/100
- Institutional Grade: Historical backtesting proves 2.3 days average early warning
Consumer Contract Example: SimpleLendingPool demonstrates how any DeFi protocol can integrate DeRisk for automated protection.
How DeRisk Fits:
- Multi-AI Consensus: 3 independent models (Claude AI 50%, Rule-based 30%, Contagion 20%)
- AI in the Loop: Claude API responses directly influence on-chain riskScore
- Weighted Median Logic: Outlier detection (>1.5 std dev) prevents manipulation
- CRE Orchestration: AI calls executed inside CRE workflow, results written on-chain
Explainability: Frontend shows per-model scores and consensus decision in Debug tab.
How DeRisk Fits:
- Confidential HTTP (implemented): Anthropic API calls use
ConfidentialHTTPClient(confidential-http@1.0.0-alpha) with{{.anthropicApiKey}}vault template β the API key is never in code or logs. Response is AES-256-GCM encrypted (encryptOutput: true) inside the TEE enclave and decrypted in-workflow usingsan_marino_aes_gcm_encryption_keyfrom VaultDON. - secrets.yaml: Maps
anthropicApiKey β ANTHROPIC_API_KEYandsan_marino_aes_gcm_encryption_key β AES_KEY_ALLfor VaultDON injection. - Protected Secrets: API keys stored in VaultDON via
secrets.yaml+workflow.yaml vaultDonSecrets, never committed to git and never exposed to DON nodes. - Private Prompts: Risk model prompts execute inside a TEE β raw AI responses never leave the enclave unencrypted.
- Institutional Use Case: Enables regulated entities (RWA issuers, centralized venues) to monitor DeFi exposure without revealing positions or proprietary risk models.
Simulation vs Production:
Simulation (CRE limitation β ConfidentialHTTPClient not supported in sim):
[4] AI scoring β ConfidentialHTTPClient attempted β falls back β rule-based scoring
Production (VaultDON):
[4] AI scoring β ConfidentialHTTPClient β {{.anthropicApiKey}} injected by vault
β response AES-GCM encrypted in TEE
β gcm(aesKey, nonce).decrypt(ciphertextAndTag) β Claude score
Why This Matters: Traditional HTTP exposes API keys and AI responses to all DON nodes. The VaultDON + ConfidentialHTTPClient architecture executes the Anthropic call inside a TEE β only the extracted numeric score exits the enclave.
- Node.js 18+ / Bun runtime
- CRE CLI β install guide Β· releases (add
creto PATH) - Sepolia ETH + Anthropic API key
# Clone repository
git clone https://github.com/MaxWK96/derisk-protocol
cd derisk-protocol
# Install workflow dependencies
cd derisk-workflow && bun install
# Install frontend dependencies
cd ../frontend && npm installcd derisk-workflow && bun install && cd ..
cre workflow simulate ./derisk-workflow --non-interactive --trigger-index 0 -T staging-settingscd frontend
npm run dev
# Open http://localhost:3001Step 1: Use the What-If Simulator (Frontend)
cd frontend && npm run dev
# Open http://localhost:3001
# Set: USDC Depeg to 4.2%, Aave TVL Drop to 15%
# Observe: Risk score β 68/100, Consumer contracts β WARNINGStep 2: Trigger CRE Workflow
cd derisk-workflow && bun install && cd ..
cre workflow simulate ./derisk-workflow --non-interactive --trigger-index 0 -T staging-settings
# Real output (see docs/cre-simulation-output.txt):
# [1/5] Aave V3: $26.73B, Compound V3: $1.30B, MakerDAO: $5.71B
# [2/5] ETH/USD: $2039.90 (live Chainlink Price Feed)
# [3/5] Contagion Risk: 83/100, Worst-Case Loss: $14.66B
# [3b] USDT: $1.0000 (STABLE), USDC: $1.0000 (STABLE), DAI: $0.9999 (STABLE)
# [4/5] Claude Score: 68/100, Scored By: Anthropic Claude AI
# [5/5] On-chain write successful. TxHash: 0x000...000 (sim mode)Step 3: Verify On-Chain
cast call 0xbC75cCB19bc37a87bB0500c016bD13E50c591f09 \
"getRiskData()(uint256,bool,uint256,uint256,uint256,uint256,uint256)" \
--rpc-url https://ethereum-sepolia-rpc.publicnode.com
# Returns: (28, false, 23683662522, 0, 281847000000, 1739887394, 247)
# Risk: 28, CircuitBreaker: false, TVL: $23.6B, ETH: $2818.47Step 4: Check Consumer Contract Response
cast call 0x942a20CF83626dA1aAb50f1354318eE04dF292c0 \
"oracle()(address)" \
--rpc-url https://ethereum-sepolia-rpc.publicnode.com
# Then read live risk from oracle via SimpleLendingPool
cast call 0xbC75cCB19bc37a87bB0500c016bD13E50c591f09 \
"riskScore()(uint256)" \
--rpc-url https://ethereum-sepolia-rpc.publicnode.comLive Evidence:
- Risk update events: View on Etherscan
- Consumer contract state: Read SimpleLendingPool
- Full simulation output: docs/cre-simulation-output.txt
Cascade simulation using empirical correlation matrix:
- Aave β Compound: 0.87 (shared lending dynamics)
- Aave β Maker: 0.72 (shared ETH collateral)
- Compound β Maker: 0.65 (indirect channels)
Monitors USDT, USDC, and DAI with severity thresholds:
- Watch: >0.5% deviation | Warning: >2% | Critical: >5%
| Model | Weight | Confidence |
|---|---|---|
| Claude AI | 50% | 95% |
| Rule-Based | 30% | 70% |
| Contagion-Adjusted | 20% | 60% |
Weighted median with outlier detection (>1.5 std dev).
| Score | Level | Circuit Breaker |
|---|---|---|
| 0-20 | LOW | Inactive |
| 21-40 | MODERATE | Inactive |
| 41-60 | ELEVATED | Inactive |
| 61-80 | HIGH | Inactive |
| 81-100 | CRITICAL | ACTIVE |
Use Case: Auto-throttle DeFi-related withdrawals during contagion events
if (deRisk.contagionRiskScore() > 60) {
// Reduce max withdrawal limits by 50%
// Increase withdrawal delays by 24h
// Alert risk team for manual review
}Why: CEXs hold billions in DeFi exposure. Early warning (2.3 day average lead time) prevents bank runs.
Use Case: Dynamically adjust over-collateralization requirements based on DeFi systemic health
uint256 baseCollateral = 120; // 120% over-collateralization
uint256 riskAdjustment = deRisk.riskScore() / 2; // +40% at max risk
uint256 requiredCollateral = baseCollateral + riskAdjustment;
require(collateralRatio >= requiredCollateral, "Insufficient collateral");Why: RWA bridges (Ondo, Centrifuge, MakerDAO RWA) need DeFi health monitoring for compliance with institutional counterparties.
Use Case: For issuers like Circle, Tether, and Paxos monitoring $150B+ in DeFi protocol reserves with 24/7 AI surveillance and depeg early warnings.
Use Case: For safety modules like those in Aave and Compound that can integrate circuit breaker signals for automatic pause during systemic risk.
Use Case: For risk teams at firms like BlackRock and Fidelity monitoring DeFi exposure with enterprise-grade dashboards and audit trails.
DeRisk uses the Chainlink secrets architecture to protect proprietary risk data, with a clear path to full Confidential HTTP in production:
What's Protected:
- Anthropic API key β declared in
secrets.yaml(anthropicApiKey β ANTHROPIC_API_KEY); injected via{{.anthropicApiKey}}template in theConfidentialHTTPClientrequest; never appears in code, logs, or config files - AES-256-GCM key β declared in
secrets.yaml(san_marino_aes_gcm_encryption_key β AES_KEY_ALL); used by the enclave to encrypt the Anthropic response and by the workflow to decrypt it; never in plaintext outside VaultDON - Risk model prompts β executed inside the TEE enclave; raw AI responses are encrypted before leaving the enclave
- No secrets in any committed file β
.env,secrets.json, andconfig.local.jsonare all gitignored
Simulation vs Production:
Simulation (CRE does not support ConfidentialHTTPClient):
[1] Fetch public data (DeFi Llama) β HTTPClient
[2] Fetch AI risk score (Anthropic) β ConfidentialHTTPClient β throws β caught
[3] Fallback β rule-based scoring
[4] Consensus + on-chain settlement β writeReport()
Production (with VaultDON):
[1] Fetch public data (DeFi Llama) β HTTPClient
[2] Fetch AI risk score (Anthropic) β ConfidentialHTTPClient (confidential-http@1.0.0-alpha)
- API key: {{.anthropicApiKey}} injected from VaultDON
- Response: AES-GCM encrypted in TEE (encryptOutput: true)
- Decrypt: gcm(aesKey, nonce).decrypt(ciphertextAndTag) using VaultDON key
[3] Consensus + on-chain settlement β writeReport()
Why This Matters: DeFi protocols use proprietary risk models. Regular HTTP exposes API keys and model responses to all DON nodes. The VaultDON + ConfidentialHTTPClient architecture executes the entire AI call inside a TEE β only the extracted numeric score exits the enclave.
Targets: Privacy & Compliance prize category
derisk-protocol/
βββ contracts/
β βββ DeRiskOracle.sol # Main oracle contract (Solidity 0.8.19)
β βββ abi/ # Contract ABIs
βββ derisk-workflow/
β βββ main.ts # CRE 5-step pipeline
β βββ config.staging.json # Workflow configuration
β βββ run-backtest.ts # Historical backtesting CLI
β βββ lib/
β βββ contagion-analyzer.ts # Cascade simulation engine
β βββ depeg-monitor.ts # Stablecoin peg monitoring
β βββ multi-ai-consensus.ts # 3-model consensus scoring
β βββ historical-backtester.ts # Backtest engine (4 events)
βββ frontend/
β βββ src/
β β βββ App.tsx # Main dashboard
β β βββ lib/contract.ts # On-chain data fetching
β β βββ components/
β β βββ RiskGauge.tsx # SVG risk gauge
β β βββ CircuitBreaker.tsx # Circuit breaker status
β β βββ BacktestTimeline.tsx # Recharts backtesting chart
β β βββ ArchitectureDiagram.tsx # Pipeline visualization
β βββ vercel.json # Deployment config
βββ docs/
β βββ BACKTESTING.md # Full methodology & results
βββ README.md
Every file in this repository that directly uses a Chainlink service:
Smart Contracts
- contracts/DeRiskOracle.sol β CRE
IReceiverinterface + Chainlink Automation (checkUpkeep/performUpkeep) - contracts/SimpleLendingPool.sol β consumer contract reading
riskScore()+circuitBreakerActive()from DeRiskOracle - contracts/RiskAwareVault.sol β consumer contract with dynamic LTV using live
riskScore() - contracts/script/DeployConsumer.s.sol β Foundry deploy script for SimpleLendingPool on Sepolia
- contracts/script/DeployRiskAwareVault.s.sol β Foundry deploy script for RiskAwareVault on Sepolia
- contracts/abi/ChainlinkPriceFeed.ts β Chainlink Price Feed ABI (
latestRoundData) used by frontend - contracts/abi/DeRiskOracle.ts β DeRiskOracle ABI consumed by CRE SDK and frontend
CRE Workflow
- derisk-workflow/main.ts β CRE 5-step pipeline:
EVMClient(Price Feeds),HTTPClient(DeFi Llama + Anthropic),writeReport(); production usesConfidentialHTTPClientfor the Anthropic call via VaultDON - derisk-workflow/workflow.yaml β CRE workflow definition, triggers, and step configuration
- derisk-workflow/config.staging.json β Chainlink Price Feed address, oracle address, Automation schedule
- derisk-workflow/config.production.json β production Price Feed and oracle configuration
- derisk-workflow/chainlink-functions-source.js β Chainlink Functions DON fallback scoring source
- derisk-workflow/deploy-functions.ts β Chainlink Functions toolkit deployment script
- derisk-workflow/lib/contagion-analyzer.ts β contagion cascade module (CRE pipeline step 3)
- derisk-workflow/lib/multi-ai-consensus.ts β multi-AI weighted median consensus (CRE pipeline step 4)
- derisk-workflow/lib/depeg-monitor.ts β stablecoin depeg monitoring module (CRE pipeline)
- derisk-workflow/lib/historical-backtester.ts β backtesting engine validated against historical Chainlink Price Feed data
Alternative CRE Workflow (Data Streams + Proof of Reserves)
- max-workflow/main.ts β CRE workflow variant with Chainlink Data Streams and Proof of Reserves
- max-workflow/workflow.yaml β CRE config for Data Streams / Proof of Reserves pipeline
- max-workflow/config.staging.json β Data Streams endpoint and Proof of Reserves proxy address
Frontend
- frontend/src/App.tsx β live dashboard reading all 5 Chainlink service outputs from DeRiskOracle
- frontend/src/components/ArchitectureDiagram.tsx β interactive Chainlink services architecture diagram (CRE, Price Feeds, Functions, Automation, Data Streams)
- frontend/src/components/CREWorkflowPanel.tsx β CRE 5-step pipeline visualization
- frontend/src/components/SystemHealth.tsx β Chainlink Price Feed staleness monitoring UI
- frontend/src/components/BacktestTimeline.tsx β historical backtesting chart using Chainlink Price Feed data
- frontend/src/components/RiskBreakdown.tsx β CRE consensus score display (per-model breakdown)
| Layer | Technology |
|---|---|
| Orchestration | Chainlink CRE (Runtime Environment) |
| AI | Anthropic Claude API |
| Blockchain | Ethereum Sepolia Testnet |
| Smart Contract | Solidity 0.8.19, Foundry |
| Frontend | React 19, Vite 7, TailwindCSS v4, Recharts |
| Data | DeFi Llama API, Chainlink Price Feeds |
| Libraries | @chainlink/cre-sdk, viem, zod |
DeRisk is a reusable primitive. Any DeFi protocol can integrate automated risk protection:
import {IDeRiskOracle} from "./interfaces/IDeRiskOracle.sol";
contract YourProtocol {
IDeRiskOracle oracle = IDeRiskOracle(0xbC75cCB19bc37a87bB0500c016bD13E50c591f09);
modifier whenSafe() {
require(oracle.getRiskData().riskScore < 80, "Risk too high");
_;
}
function criticalOperation() external whenSafe {
// Your logic here β protected by DeRisk
}
}That's it. No API keys, no complex setup. Just read the on-chain risk score.
Use Cases:
- Lending protocols: Pause deposits during systemic risk
- Stablecoin issuers: Monitor collateral health
- Institutional treasuries: Auto-hedge based on risk signals
- Live Demo: frontend-4b4fiyt5o-maxs-projects-64e484e7.vercel.app
- Demo Video: YouTube β Full Walkthrough
- Contract: 0xbC75...1f09 on Sepolia
- Backtesting Docs: docs/BACKTESTING.md
Built for Chainlink Convergence Hackathon 2026