https://github.com/vishalchau2003/zeru-internship-compound-v2
https://github.com/vishalchau2003/zeru-internship-compound-v2
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/vishalchau2003/zeru-internship-compound-v2
- Owner: Vishalchau2003
- Created: 2025-07-27T11:42:38.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-07-28T10:21:11.000Z (3 months ago)
- Last Synced: 2025-07-28T12:19:40.821Z (3 months ago)
- Language: Python
- Size: 15.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 🧠Wallet Risk Scorer on Compound Finance
This project analyzes user wallet activity on the Ethereum blockchain (specifically with Compound tokens like cDAI and cETH) and computes a **wallet risk score** based on borrow/redeem patterns.
## 📦 Overview
- **Blockchain**: Ethereum
- **Tokens**: cDAI, cETH
- **Data Source**: [Etherscan API](https://etherscan.io/apis)
- **Output**: A CSV file containing wallet addresses and their respective risk scores.
---
## 📊 Methodology
### 📥 Data Collection Method
We use the **Etherscan Token Transfer API** to fetch all historical ERC-20 token transactions related to Compound's `cDAI` and `cETH` tokens for a given wallet. The API returns:
- Timestamp
- From/To addresses
- Token amount
- Block number
- Token metadata (decimals, name)
This allows us to determine user activity on the Compound protocol.
### 🎯 Feature Selection Rationale
For each wallet, we extract:
- `borrow_tx`: Number of token transfers **into** the wallet (proxy for borrow/mint)
- `redeem_tx`: Number of token transfers **from** the wallet (proxy for redeem/repay)
- `total_volume`: Total value of all cToken transactions in the wallet's history
These three features offer a rough but informative glimpse into user behavior on Compound.
### 🧮 Scoring Method
We assign a score out of 1000 using this logic:
- Start with 1000 points
- Penalize based on **borrow/redeem ratio** → higher ratio = riskier
- Penalize **high redeem activity** → potential aggressive withdrawals
```python
ratio = borrow_tx / (redeem_tx + 1e-9)
score = 1000 - min(ratio * 300, 300) - min(redeem_tx * 50, 200)