Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
af16b20
prediction market style
sree-sanak Jul 27, 2025
99c1c79
update prediction market style theme
sree-sanak Jul 27, 2025
73af110
better prediction market with live info
sree-sanak Jul 27, 2025
d12062d
lots of UI fixes and better contract connections
sree-sanak Jul 27, 2025
404acce
use real pool data
sree-sanak Jul 27, 2025
45e8d8b
update browserlist
sree-sanak Jul 28, 2025
000da90
update prediction market with simpler explanation of What You Pay, Wh…
sree-sanak Jul 31, 2025
990618c
move widget to home page and add docs
sree-sanak Aug 4, 2025
8968b6e
deposits and withdrawals can happen at any time
sree-sanak Aug 4, 2025
45e0b9f
update tests as needed for anytime deposit and withdrawals
sree-sanak Aug 4, 2025
f5a34bb
MAJOR update to the protocol design (removing the differences between…
sree-sanak Aug 4, 2025
30cb2ee
add partner logos
sree-sanak Aug 5, 2025
b844364
Merge pull request #3 from CoverMax-DeFi/prediction-market
sree-sanak Aug 5, 2025
d503c8b
update UI to match updated protocol design
sree-sanak Aug 5, 2025
a280eb6
add unified page
sree-sanak Aug 5, 2025
fcfafaf
rebalance portfolio risk
sree-sanak Aug 5, 2025
fcdc957
simplify language
sree-sanak Aug 5, 2025
85f5aaa
clean up imports
sree-sanak Aug 5, 2025
0d08224
unified dashboard with all the info, clean
sree-sanak Aug 5, 2025
b3cd3e2
unified page components are also unified
sree-sanak Aug 5, 2025
e79b58d
remove old pages, and refactor unified dashboard page into a proper p…
sree-sanak Aug 5, 2025
bcaa695
update widget page header
sree-sanak Aug 5, 2025
620bf52
fix refresh page button
sree-sanak Aug 5, 2025
3c35d7a
clean up components and unified dashboard renaming
sree-sanak Aug 5, 2025
059b5d9
clean up unused components and use statcards where appropriate
sree-sanak Aug 5, 2025
bc316fc
changing the language of add/remove liquidity to becoming stake/unsta…
sree-sanak Aug 5, 2025
6cbf9b5
update context of add/remove liquidity to stake/unstake risk tokens
sree-sanak Aug 5, 2025
3f55d99
rename the advanced to staking, remove max text, and update display o…
sree-sanak Aug 6, 2025
58d915f
load data faster and remove unused imports
sree-sanak Aug 6, 2025
6f73f89
data loads much faster now
sree-sanak Aug 6, 2025
47e51fd
code clean up after fixing data loading problem
sree-sanak Aug 6, 2025
2eeb4e0
update the page refresh code to keep it simpler
sree-sanak Aug 6, 2025
5a9e348
update the input fields to have the max button
sree-sanak Aug 6, 2025
f69bd78
ai recommendation on the betting
sree-sanak Aug 7, 2025
faedc16
add wallet info stuff
sree-sanak Aug 7, 2025
e1dc439
portfolio + covermax protocl aware ai to help betting decisions
sree-sanak Aug 7, 2025
21b1ca8
simplified page
sree-sanak Aug 7, 2025
773a81c
simplified widget page
sree-sanak Aug 7, 2025
dac7685
fix precedence bug in risk vault!
sree-sanak Aug 7, 2025
55f8df9
Merge branch 'ui-updates' into dev
sree-sanak Aug 7, 2025
9f5f380
go back to simple evm tooling for holdings
sree-sanak Aug 8, 2025
e79bb7d
Merge branch 'hedera-agent-kit' into dev
sree-sanak Aug 8, 2025
f2e9316
redeploy contracts
sree-sanak Aug 8, 2025
f80d691
dashboard ui fixes
sree-sanak Aug 8, 2025
5bca32e
fix withdraw issues and also inconsistencies with phase info for the …
sree-sanak Aug 8, 2025
40e5a40
clean up withdraw UI
sree-sanak Aug 8, 2025
684f2f1
clean up rounding issues around staking
sree-sanak Aug 8, 2025
6b00b78
update staking component UI
sree-sanak Aug 8, 2025
36aacb8
remove force transition (after time check) and add restart cycle button!
sree-sanak Aug 8, 2025
6c9f1be
update the widget UI
sree-sanak Aug 8, 2025
b3c1e50
remove protocol stats
sree-sanak Aug 8, 2025
f2adf32
simplify readme
sree-sanak Aug 8, 2025
58cb6e3
fix strategy preview on dashboard
sree-sanak Aug 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 37 additions & 79 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
# CoverMax 🛡️

*A decentralized insurance protocol powered by tradeable risk tokens*
_A decentralized insurance protocol powered by tradeable risk tokens_

## 🎮 Quick Start for Testing

Want to try out CoverMax? 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
Expand All @@ -33,13 +35,13 @@ Watch CoverMax in action: https://youtu.be/CvOf5WiP0co

### The Insurance Mechanism

1. **Deposit Phase** (2 days): Users deposit yield-bearing assets (aUSDC, cUSDT) into insurance pools
1. **Continuous Deposits**: Users can deposit yield-bearing assets (aUSDC, cUSDT) at any time during the protocol lifecycle
2. **Token Issuance**: For each deposit, users receive equal amounts of:
- **Senior Risk Tokens** (CM-SENIOR) - Lower risk, priority claims
- **Junior Risk Tokens** (CM-JUNIOR) - Higher risk, subordinate claims
3. **Trading Phase**: Risk tokens can be traded on Uniswap like any ERC20 token
4. **Coverage Phase** (3 days): Active insurance period where claims can be submitted
5. **Redemption Phase**: Token holders can redeem remaining tokens for underlying assets
3. **Trading**: Risk tokens can be traded on Uniswap like any ERC20 token throughout all phases
4. **Active Phase** (5 days): Combined deposit and coverage period where claims can be submitted
5. **Flexible Redemption**: Token holders can redeem tokens at any time with phase-specific rules

### The Risk-Insurance Relationship

Expand All @@ -52,6 +54,7 @@ The core innovation is that **selling risk tokens = providing insurance coverage
### Example Scenarios

#### Risk Tier Trading (Advanced Strategy)

```
1. Alice deposits 1000 aUSDC → receives 500 CM-SENIOR + 500 CM-JUNIOR tokens
2. Bob deposits 1000 cUSDT → receives 500 CM-SENIOR + 500 CM-JUNIOR tokens
Expand All @@ -76,131 +79,84 @@ The core innovation is that **selling risk tokens = providing insurance coverage

- **aUSDC**: Aave interest-bearing USDC
- **cUSDT**: Compound interest-bearing USDT
- *Extensible to other yield-bearing assets*
- _Extensible to other yield-bearing assets_

### Risk Token Tiers

| Token Type | Risk Level | Claim Priority | Use Case |
|------------|------------|----------------|----------|
| Token Type | Risk Level | Claim Priority | Use Case |
| ---------- | ---------- | -------------- | -------------------------------- |
| CM-SENIOR | Lower | First claims | Conservative insurance providers |
| CM-JUNIOR | Higher | Subordinate | Risk-seeking yield farmers |
| CM-JUNIOR | Higher | Subordinate | Risk-seeking yield farmers |

## 🔄 Protocol Lifecycle

### Phase 1: Deposit Period (2 days)
- Users deposit yield-bearing assets
### Phase 1: Active Period (5 days)

- Combined deposit and coverage period for maximum flexibility
- Users can deposit yield-bearing assets at any time during the protocol lifecycle
- Active insurance coverage for all deposited assets
- Dual-tier risk tokens are minted 1:1 with deposits
- Tokens can be traded immediately on Uniswap

### Phase 2: Coverage Period (5 days)
- Active insurance coverage for deposited assets
- Withdrawals require equal amounts of senior and junior tokens
- Claims can be submitted and processed
- Risk tokens continue trading on secondary markets

### Phase 3: Senior Claims (1 day)
### Phase 2: Claims Period (1 day)

- Priority redemption period for senior token holders
- Senior tokens have first claim on remaining assets
- Any combination of senior/junior tokens can be withdrawn (in normal mode)
- In emergency mode: only senior token withdrawals allowed
- Deposits continue to be accepted

### Phase 3: Final Claims (1 day)

### Phase 4: Final Claims (1 day)
- All remaining tokens can be redeemed
- All remaining tokens can be redeemed with any combination of senior/junior
- Deposits continue to be accepted
- Protocol cycle completes and can restart

## 💰 Economic Model

### For Insurance Providers

- **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

### For Risk Traders

- **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

### For Insurance Seekers

- **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

## 🦄 Uniswap Integration

### Why Uniswap?

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

### Trading Strategy Examples

#### 1. Risk Tier Arbitrage (CM-SENIOR ↔ CM-JUNIOR Pool)
```solidity
// Strategy: Trade down risk by converting junior to senior tokens
// Bob wants more downside protection, less upside exposure
uniswapRouter.swapExactTokensForTokens(
200 * 1e18, // Sell 200 CM-JUNIOR tokens
190 * 1e18, // Expect ~190 CM-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)
```

#### 2. Complete Risk Exit (Risk Token → Stablecoin)
```solidity
// Strategy: Exit insurance position entirely
// Sell risk tokens for stablecoins to eliminate exposure
uniswapRouter.swapExactTokensForTokens(
250 * 1e18, // Sell 250 CM-SENIOR tokens
minAmountOut,
[seniorToken, USDC],
msg.sender,
deadline
);
```

#### 3. Risk Speculation (Stablecoin → Risk Token)
```solidity
// 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
);
```

## 🔧 Technical Implementation

### Smart Contract Features

- **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

### Security Considerations

- **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

## 📊 Key Metrics

### Protocol Health

- **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

### Market Dynamics

- **Risk Token Price**: Market valuation of insurance risk
- **Liquidity Depth**: Available trading volume on Uniswap
- **Volatility**: Price stability of risk tokens
Expand Down Expand Up @@ -237,11 +193,13 @@ npx hardhat test
All tests should pass. For troubleshooting, ensure you are using a compatible Node.js version and Hardhat is installed.

# Deploy to local network

npx hardhat ignition deploy ignition/modules/RiskToken.ts --network localhost

## 🤝 Contributing

Contributions welcome! This project includes:

- **Hardhat development environment**
- **TypeScript support**
- **Comprehensive test suite**
Expand All @@ -257,4 +215,4 @@ For commercial licensing inquiries, contact: legal@covermax.fi

---

*CoverMax: Phase-based risk management with dual-tier tokens*
_CoverMax: Phase-based risk management with dual-tier tokens_
Loading