DeFi RISK Engine is an open-source risk modeling tool for DeFi protocols, designed to assess institutional lending risks using raw on-chain data. The project focuses on modular, autonomous, and scalable risk computation, starting with Health Factor (HF) prediction.
- Raw On-Chain Data – No third-party APIs, ensuring institutional-grade reliability.
- Modular OOP Architecture – Separate classes for fetching, processing, and modeling.
- Extensible Risk Models – Initial focus on Health Factor (HF) calculations.
- Open Source & Transparent – Built in public for collaboration and industry credibility.
- Integrated Data Collection – Uses
DeFi Data Collectorsas a submodule for on-chain data.
The first milestone is to develop a functional Risk Engine that:
- Fetches raw on-chain data directly (collateral price, loan value, liquidation threshold, etc.).
- Identifies institutional wallets (hedge funds, investment firms).
- Computes historical Health Factor (HF) for these wallets based on their positions.
- Structures this data into a clean dataset for analysis.
- Integrates an initial Risk Model to analyze HF trends and potential liquidation risks.
-engine/
│── data_collectors/ # Submodule for fetching raw blockchain data
│── data_processing/ # Processes fetched data into structured format
│ ├── processor.py
│ ├── __init__.py
│
│── risk_core/ # Risk Engine logic (actual risk models)
│ ├── risk_model.py
│ ├── __init__.py
│
│── tests/ # Unit tests for each module
│
│── config.py # Configurations (RPCs, addresses)
│── requirements.txt # Dependencies
│── README.md # Documentation
│── .gitignore # Ignore unnecessary files
# Clone the repository
git clone --recursive https://github.com/yourusername/risk-engine.git
cd risk-engine
# Initialize and update submodules
git submodule update --init --recursive
# Install dependencies
pip install -r requirements.txtUpdating the DeFi Data Collectors submodule If the DeFi Data Collectors repo is updated, sync it in the Risk Engine:
git submodule update --remoteWe welcome contributions! If you're interested in improving risk models or blockchain data processing, feel free to submit PRs or open discussions.