A decentralized insurance protocol powered by tradeable risk tokens
Want to try out CoverVault? Use this test wallet that already has test tokens:
Test Private Key:
994fc012e651448eacdba62f2e49c17796e44aac67155e512894c23ddbf3e1fd
This wallet is pre-funded with test tokens (aUSDC, cUSDT) that you can use to:
- Deposit into insurance pools
- Receive and trade risk tokens
- Submit test claims
- Experience the full protocol lifecycle
CoverVault is a revolutionary insurance protocol that transforms traditional insurance through tradeable risk tokens for yield-bearing collateral. Users deposit yield-bearing assets (like aUSDC or cUSDT) and receive dual-tier risk tokens that can be traded on Uniswap. The more risk tokens sold in the market, the more insurance coverage is provided to the community.
Watch CoverVault in action: https://youtu.be/CvOf5WiP0co
- Deposit Phase (2 days): Users deposit yield-bearing assets (aUSDC, cUSDT) into insurance pools
- Token Issuance: For each deposit, users receive equal amounts of:
- Senior Risk Tokens (CV-SENIOR) - Lower risk, priority claims
- Junior Risk Tokens (CV-JUNIOR) - Higher risk, subordinate claims
- Trading Phase: Risk tokens can be traded on Uniswap like any ERC20 token
- Coverage Phase (3 days): Active insurance period where claims can be submitted
- Redemption Phase: Token holders can redeem remaining tokens for underlying assets
The core innovation is that selling risk tokens = providing insurance coverage:
- When you hold risk tokens: You bear the risk of insurance claims
- When you sell risk tokens: You transfer that risk to the buyer
- When you buy risk tokens: You're taking on insurance risk for potential yield
1. Alice deposits 1000 aUSDC → receives 500 CV-SENIOR + 500 CV-JUNIOR tokens
2. Bob deposits 1000 cUSDT → receives 500 CV-SENIOR + 500 CV-JUNIOR tokens
3. Bob wants more downside protection, so he trades on CV-SENIOR/CV-JUNIOR pool:
- Sells 200 CV-JUNIOR tokens → receives 190 CV-SENIOR tokens (5% lost in value)
4. Bob now holds 690 CV-SENIOR + 300 CV-JUNIOR tokens (990 total)
- Result: Bob forfeited 10 tokens of potential upside for senior claim priority
5. Alice see a opportunity to buy cheap CV-JUNIOR tokens that are redeemable to the same underlying token, so she buys the them. She now holds 310 CV-SENIOR + 700 CV-JUNIOR tokens (1010 total)
6. If one of the underlying yield protocols get exploited: Bob's 690 senior tokens get paid before any junior tokens. He can withdraw up to 990 yield tokens.
7. if there was no exploit: Alice's 310 senior tokens get paid before any junior tokens. She can withdraw up to 1010 yield tokens.
RiskVault.sol: Main protocol contract managing deposits, claims, and tokenizationRiskToken.sol: ERC20 implementation for risk tokens with mint/burn functionalityIRiskToken.sol: Interface for risk token operations
- aUSDC: Aave interest-bearing USDC
- cUSDT: Compound interest-bearing USDT
- Extensible to other yield-bearing assets
| Token Type | Risk Level | Claim Priority | Use Case |
|---|---|---|---|
| CV-SENIOR | Lower | First claims | Conservative insurance providers |
| CV-JUNIOR | Higher | Subordinate | Risk-seeking yield farmers |
- Users deposit yield-bearing assets
- Dual-tier risk tokens are minted 1:1 with deposits
- Tokens can be traded immediately on Uniswap
- Active insurance coverage for deposited assets
- Claims can be submitted and processed
- Risk tokens continue trading on secondary markets
- Priority redemption period for senior token holders
- Senior tokens have first claim on remaining assets
- All remaining tokens can be redeemed
- Protocol cycle completes and can restart
- Deposit yield-bearing assets to earn insurance premiums
- Hold tokens to bear risk and earn yield from claims that don't materialize
- Sell tokens to reduce risk exposure and lock in profits
- Buy risk tokens on Uniswap to speculate on insurance outcomes
- Sell risk tokens to exit positions or reduce exposure
- Arbitrage between risk levels and market pricing
- Submit claims backed by evidence when covered events occur
- Receive payouts from the insurance pool when claims are approved
- Benefit from community-funded insurance coverage
Risk tokens are standard ERC20 tokens that can be traded on any DEX. Uniswap provides:
- Liquidity: Deep markets for risk token trading
- Price Discovery: Market-driven risk pricing
- Accessibility: Anyone can buy/sell insurance risk
- Composability: Risk tokens can be used in other DeFi protocols
// Strategy: Trade down risk by converting junior to senior tokens
// Bob wants more downside protection, less upside exposure
uniswapRouter.swapExactTokensForTokens(
200 * 1e18, // Sell 200 CV-JUNIOR tokens
190 * 1e18, // Expect ~190 CV-SENIOR tokens (forfeit some upside)
[juniorToken, seniorToken],
msg.sender,
deadline
);
// Result: Bob now has more senior tokens (priority claims)
// but less junior tokens (subordinate claims)// Strategy: Exit insurance position entirely
// Sell risk tokens for stablecoins to eliminate exposure
uniswapRouter.swapExactTokensForTokens(
250 * 1e18, // Sell 250 CV-SENIOR tokens
minAmountOut,
[seniorToken, USDC],
msg.sender,
deadline
);// Strategy: Buy underpriced risk for potential yield
// Charlie thinks insurance claims are unlikely
uniswapRouter.swapExactTokensForTokens(
1000 * 1e6, // Spend 1000 USDC
minTokensOut,
[USDC, juniorToken],
msg.sender,
deadline
);- Reentrancy Protection: All external functions protected against reentrancy attacks
- Phase-Based Logic: Automated lifecycle management with time-based phases
- Proportional Redemption: Fair distribution of assets based on token holdings
- Emergency Pause: Owner can pause protocol in emergencies
- Claim Processing: Structured insurance claim submission and approval system
- Audited OpenZeppelin contracts for standard functionality
- Custom errors for gas-efficient error handling
- Precision math using 27-decimal precision for accurate calculations
- Access controls with owner-only administrative functions
- Total Value Locked (TVL): Combined value of all deposited assets
- Insurance Coverage Ratio: Amount of active insurance coverage
- Token Distribution: Spread of risk across token holders
- Claim Success Rate: Percentage of approved vs submitted claims
- Risk Token Price: Market valuation of insurance risk
- Liquidity Depth: Available trading volume on Uniswap
- Volatility: Price stability of risk tokens
- Arbitrage Opportunities: Price differences between risk tiers
- Automated tests are provided for all core contracts in
test/RiskToken.test.tsandtest/RiskVault.test.ts. - The test suite covers:
- Deployment and initialization
- Minting and burning permissions and edge cases
- Deposit and withdrawal logic, including error scenarios
- Asset support and minimum/uneven deposit checks
- Event emission and state changes
- Revert and access control checks
# Install dependencies
npm install
# Compile contracts
npx hardhat compile
# Run all tests
npx hardhat testAll tests should pass. For troubleshooting, ensure you are using a compatible Node.js version and Hardhat is installed.
npx hardhat ignition deploy ignition/modules/RiskToken.ts --network localhost
Contributions welcome! This project includes:
- Hardhat development environment
- TypeScript support
- Comprehensive test suite
- Deployment scripts
MIT License
CoverVault: Phase-based risk management with dual-tier tokens
