All projects
Flash Crash Insurance Pool
Automated parametric insurance for DeFi LPs that pays out instantly when a flash crash occurs
DeFi & Tokenization Risk & Compliance
What it is
What is it?
Flash Crash Insurance Pool is an automated, parametric insurance protocol for DeFi Liquidity Providers (LPs). It provides instant payouts when a verified flash crash or depeg event occurs—no claims, no humans, just code.
How it works:
- Buy Protection: LPs purchase insurance tickets by paying premiums (AVAX) into the pool contract on Avalanche Fuji
- Constant Monitoring: A Chainlink CRE workflow runs every 5 minutes, fetching price data from an external API with DON consensus
- Crash Detection: If price deviation exceeds 5% from baseline, a crash event is automatically detected
- Instant Payout: The CRE workflow generates a signed report via runtime.report() and submits it to the contract via evmClient.writeReport(). The forwarder validates the report and executes executePayout(), distributing the pool equally to all active ticket holders
What problem it solves:
DeFi LPs currently have no protection against flash crashes. When a stablecoin depegs or a pool experiences sudden price drops, LPs lose significant value with no recourse. Existing insurance requires manual claims, KYC, and governance votes—taking days or weeks. By then, it's too late. Our solution provides INSTANT, automated protection with no human intervention.
How it Works
Tech Stack:
- Smart Contract: Solidity v0.8.28 + OpenZeppelin (ReceiverTemplate, Ownable, ReentrancyGuard)
- Workflow Orchestration: Chainlink Runtime Environment (CRE) with TypeScript SDK
- Type Safety: TypeChain + ethers v6 for contract bindings
- Blockchain: Avalanche Fuji Testnet
- Development: Hardhat v3 + TypeScript
- Testing: Mocha + Chai + Hardhat Network
- Price API: mathjs.org (random number generation to simulate price feeds)
InsurancePool.sol (Avalanche Fuji) ← CRE Workflow (my-crash-monitor-workflow/) ← Price API
Key Components:
- Smart Contract: Inherits from ReceiverTemplate for secure forwarder validation. Only the CRE forwarder can trigger executePayout().
- CRE Workflow: Uses cron trigger, HTTP client with DON consensus, EVM reads/writes, and signed reports.
- Type-Safe Bindings: Custom InsurancePoolCRE wrapper adapts TypeChain-generated types for CRE's patterns.
- Testing Suite: Comprehensive Hardhat tests + end-to-end demo script.
Chainlink CRE Capabilities Used:
- CronCapability - Scheduled execution every 5 minutes
- HTTPClient - Off-chain price data fetching with DON consensus
- EVMClient - On-chain reads (getActiveHolders()) and writes (executePayout())
- consensusMedianAggregation - DON data verification
- runtime.report() - Signed report generation
- evmClient.writeReport() - Report submission via forwarder
Links
Created by
- Augustine Onuora