Eigensurance is a decentralized disaster insurance protocol built on EigenLayer that leverages multiple operator validation for disaster event verification and claims processing.
The protocol consists of several key components:
DisasterInsuranceServiceManager
: Main contract handling policy creation, disaster validation, and claimsMockDisasterOracle
: Simulates disaster data feedsMockStakeRegistry
: Handles operator registration and validationMockAVSDirectory
: Manages AVS operator registration
- Clone the repository:
git clone https://github.com/andrewgcodes/eigen.git
cd eigen
- Install dependencies:
npm install
- Copy environment files:
cp .env.example .env
cp contracts/.env.example contracts/.env
- Start local Anvil chain:
npm run start:anvil
- In a new terminal, deploy the contracts:
# Deploy EigenLayer core contracts
npm run deploy:core
# Deploy Disaster Insurance contracts
npm run deploy:insurance
Create a new insurance policy:
npm run insurance:create-policy
This creates a policy with:
- Coverage amount: 1 ETH
- Location: San Francisco
- Disaster Type: EARTHQUAKE
- Premium: 5% of coverage amount
Simulate a disaster event:
npm run insurance:simulate-disaster
This simulates an earthquake in San Francisco with:
- Severity: 7.0 on Richter scale
- Multiple operator validations
- Event verification
Process an insurance claim:
npm run insurance:process-claim
This processes the claim for:
- The most recently created policy
- The most recent disaster event
- Transfers coverage amount to policyholder if valid
Run the test suite:
cd contracts
forge test -vv
The tests cover:
- Policy creation
- Disaster event simulation
- Multi-operator validation
- Claim processing
- Edge cases and error conditions
After deployment, contract addresses can be found in:
- EigenLayer Core:
deployments/core/31337.json
- Disaster Insurance:
deployments/disaster-insurance/31337.json
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'feat: add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License.
This is a prototype and has not been audited. Do not use in production.