Assure-Fi
Decentralized Insurance for DeFi Protocols
What it is
Assure-Fi is an on-chain insurance protocol that lets DeFi users buy coverage against catastrophic market events like stablecoin depegs, asset price crashes, and protocol TVL collapses, smart contract hacks. The risk associated with smart contracts are at an all time high, this protocol offers a way for users to have a backup. Unlike traditional insurance, there are no claims adjusters, no paperwork, and no waiting periods. When a predefined trigger condition is met, claims are open immediately and payouts are settled automatically on-chain.
DeFi carries significant tail risks that users have no protection against:
- Stablecoin depegs — USDC, USDT, and others have lost their peg during market stress events, wiping out users who held them as "safe" assets.
- Asset crashes — Sudden BTC or ETH price collapses can leave leveraged positions underwater with no recourse.
- Protocol failures — A sharp TVL drop in Aave, Compound, or Curve often signals an exploit, liquidity crisis, or loss of confidence — events that can devastate depositors.
Traditional insurance doesn't work for DeFi. It's too slow, requires trust in a centralised insurer, and can't verify on-chain events.
Assure-Fi uses a parametric model — payouts are triggered by objective, verifiable on-chain data, not subjective claims assessment.
- Liquidity Providers fund the pools
LPs deposit capital into risk pools. Each pool covers a specific event type. In return, LPs earn premiums paid by policyholders. This is the protocol's underwriting layer. - Users buy policies
A user selects a pool, sets a coverage amount and duration, and pays a premium upfront. The premium is calculated as:
Premium = Coverage × Annual Rate × (Duration / 365 days)
For example, With a 5% annual rate, covering $10,000 for 3 months costs ~$125. - Chainlink CRE monitors conditions
Chainlink's Compute & Runtime Environment (CRE) polls live data sources every 30 seconds:
- Price feeds (Chainlink Data Feeds) for USDC, BTC, and ETH
- TVL feeds (DeFiLlama API) for Aave, Compound, and Curve
When a trigger threshold is breached — e.g. USDC drops below $0.995, or BTC falls below $10,000 — the CRE calls onReport on the TriggerManager contract, marking the pool as triggered.
- Policyholders claim
Once a pool is triggered, any active, unexpired policyholder can call claim(). The contract verifies:
- They hold a valid policy in that pool
- The pool is in a triggered state
- The policy has not already been claimed
The payout is coverageAmount × coverageRatio (% of the insured amount by default), transferred directly to the policyholder's wallet — no intermediaries.
- Systemic risk protection
A SystemicController watches across all pools simultaneously. If multiple pools trigger at once, indicating a systemic DeFi crisis, it can inject emergency liquidity from a GlobalInsurance reserve, protecting the protocol's solvency even in black swan scenarios.
How it Works
Link to App - https://assure-fi.netlify.app
Smart Contracts (Solidity + Foundry)
The protocol is built around a modular contract architecture:
BaseRiskPool — Abstract base contract containing all core insurance logic: liquidity deposits, policy purchases, claims processing, and payout calculations. Uses OpenZeppelin's ReentrancyGuard and SafeERC20.
RiskPoolPrice — Extends BaseRiskPool for price-based triggers (USDC depeg, BTC/ETH crashes).
RiskPoolTVL — Extends BaseRiskPool for TVL-based triggers (Aave, Compound, Curve).
TriggerManager — Central registry that maps each pool to its trigger configuration (threshold, data source type). Receives oracle reports from Chainlink CRE and marks pools as triggered.
SystemicController — Monitors all pools simultaneously. If a configurable number of pools trigger at once, it injects emergency liquidity from a global reserve — protecting against cascading failures.
GlobalInsurance — Holds the systemic reserve fund used for emergency injections.
Contracts are tested and deployed with Foundry (forge test, forge script), live on Sepolia testnet.
Oracle Automation (Chainlink CRE)
The trigger system uses Chainlink's Compute & Runtime Environment (CRE) — a decentralised off-chain compute layer that runs custom workflows on a schedule.
Three workflow types run every ~30 seconds:
Price workflow — Reads Chainlink Data Feeds (BTC/USD, ETH/USD, USDC/USD) and calls TriggerManager.onReport() if price drops below threshold.
TVL workflow — Fetches live TVL data from the DeFiLlama API, computes a percentage drop, and calls onReport() if the drop exceeds the threshold.
Systemic workflow — Monitors the number of triggered pools across the protocol and calls SystemicController.onReport() if the count exceeds the configured threshold, triggering emergency liquidity injection from the GlobalInsurance reserve.
The onReport functions are restricted to the Chainlink forwarder address via an onlyForwarder modifier, preventing any other address from spoofing trigger events.
Frontend (React + Wagmi + Viem)
React with TypeScript, bundled by Vite
Wagmi v2 for all wallet and contract interactions — useReadContracts for batched on-chain reads, useWriteContract + useWaitForTransactionReceipt for transactions
Viem for type-safe ABI encoding
Tailwind CSS for styling with custom glass-morphism design system
Tenderly Simulation — Before any buyPolicy or claim transaction is submitted, the calldata is sent to Tenderly's simulation API against the live Sepolia state. If the simulation returns a revert, the error reason is surfaced in the UI before the user's wallet is ever opened, preventing wasted gas and confusing MetaMask errors. Failed simulations are saved to Tenderly's dashboard (save_if_fails: true) for debugging.
Thirdweb Connect UI — The wallet connection flow uses a custom multi-wallet modal built on Wagmi's connector system, extended with Thirdweb's SDK. Supports Browser Wallet (MetaMask and any injected provider), Coinbase Wallet, and WalletConnect. Both the connect modal and the connected-wallet sheet are rendered via React portals to avoid z-index stacking issues, providing a consistent experience across desktop and mobile.
Deployed on Netlify
Links
Created by
- Joshua Adesanya
- Lionel Daniel Aliu