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:

  1. Buy Protection: LPs purchase insurance tickets by paying premiums (AVAX) into the pool contract on Avalanche Fuji
  2. Constant Monitoring: A Chainlink CRE workflow runs every 5 minutes, fetching price data from an external API with DON consensus
  3. Crash Detection: If price deviation exceeds 5% from baseline, a crash event is automatically detected
  4. 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:

  1. Smart Contract: Inherits from ReceiverTemplate for secure forwarder validation. Only the CRE forwarder can trigger executePayout().
  2. CRE Workflow: Uses cron trigger, HTTP client with DON consensus, EVM reads/writes, and signed reports.
  3. Type-Safe Bindings: Custom InsurancePoolCRE wrapper adapts TypeChain-generated types for CRE's patterns.
  4. 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