A comprehensive, real-time monitoring system that automatically discovers and analyzes all available Uniswap V3 liquidity pools with advanced risk assessment capabilities.
- Automatic Detection: Discovers all Uniswap V3 pools above configurable thresholds
- Real-time Updates: Continuously monitors for new pool creations
- Intelligent Filtering: Filters out dust pools and invalid tokens
- Scalable Architecture: Handles 1000+ pools with pagination support
- Multi-Dimensional Risk Scoring: 4 comprehensive risk categories
- Liquidity Risk: TVL volatility, concentration, depth analysis
- Market Risk: Price impact, impermanent loss probability
- Operational Risk: Fee efficiency, transaction frequency, pool maturity
- Systemic Risk: Token ecosystem health, cross-pool dependencies
- Real-time Alerts: Automated risk threshold monitoring
- Historical Analysis: Volume stability and trend analysis
- Interactive Visualizations: Risk heatmaps, distribution charts, trend analysis
- Advanced Filtering: Filter by TVL, risk level, volume, and more
- Real-time Updates: Configurable refresh intervals (60-600 seconds)
- Risk Heatmap: Visual representation of all risk components
- Top/Safest Pools: Automated identification of highest risk and safest pools
- Redis Caching: High-performance data storage and retrieval
- Error Handling: Robust fallback mechanisms and error recovery
- Rate Limiting: Intelligent API usage management
- Monitoring: Real-time pool creation detection and alerting
graph TB
A[The Graph Subgraph] -->|Dynamic Discovery| B[Pool Discovery Engine]
B --> C[Intelligent Filtering]
C --> D[Advanced Risk Engine]
D --> E[Redis Cache]
E --> F[Streamlit Dashboard]
G[Uniswap] -->|PoolCreated Events| H[Real-time Monitor]
H --> B
I[Infura/Web3] -->|On-chain Data| J[Data Validation]
J --> D
K[Alert System] -->|Risk Thresholds| L[Notifications]
D --> K
-
Liquidity Risk (25%)
- TVL volatility (EWMA-based)
- Liquidity depth vs volume ratio
- Pool size concentration
-
Market Risk (30%)
- Price impact calculations
- Impermanent loss probability
- Volume stability analysis
-
Operational Risk (20%)
- Fee tier efficiency
- Transaction frequency
- Pool maturity assessment
-
Systemic Risk (25%)
- Token ecosystem health
- Cross-pool dependencies
- Market cap correlations
- Low Risk (0.0-0.3): Excellent risk profile
- Medium Risk (0.3-0.6): Moderate risk with acceptable volatility
- High Risk (0.6-0.8): Elevated risk requiring monitoring
- Critical Risk (0.8-1.0): High risk - use with extreme caution
- Python 3.8+: Core application logic
- The Graph: Subgraph API for pool data
- Web3.py: Blockchain interaction and event monitoring
- Redis: High-performance caching and data persistence
- Streamlit: Interactive dashboard and visualizations
- Plotly: Advanced charting and risk heatmaps
- Pandas: Data processing and analysis
- Asyncio: Asynchronous data fetching and processing
- Python 3.8+
- Redis server
- Infura API key (optional, uses public subgraph by default)
# Clone the repository
git clone https://github.com/Dairus01/uniswap_v3_risk_tracker.git
cd defi-risk-dashboard
# Install dependencies
pip install -r requirements.txt
Create a .env file in the project root:
# Blockchain connections (optional - uses public subgraph by default)
INFURA_URL=https://mainnet.infura.io/v3/YOUR_INFURA_KEY
# Redis configuration
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_DB=0
# Optional: Custom subgraph (uses official Uniswap V3 subgraph by default)
subgraph_api_key=your_graph_api_key
subgraph_id=your_subgraph_idstreamlit run src/dashboard.pyThe dashboard will be available at http://localhost:8501
- Automatically discovers all Uniswap V3 pools
- Configurable minimum TVL threshold ($1K - $10M)
- Intelligent filtering of invalid/dust pools
- Real-time pool creation monitoring
- Filter by TVL range
- Filter by risk level (Low/Medium/High/Critical)
- Filter by volume and activity
- Limit number of pools for performance
- Risk Distribution Pie Chart: Shows distribution of risk levels
- Risk Heatmap: Visual representation of risk components
- Pool Analysis Table: Comprehensive pool metrics
- Top Risky/Safest Pools: Automated risk ranking
- Configurable refresh intervals (60-600 seconds)
- Automatic data updates
- Error handling and fallback mechanisms
- Performance optimization for large datasets
- Pagination: Handles 1000+ pools efficiently
- Caching: Redis-based data persistence
- Async Processing: Non-blocking data fetching
- Intelligent Filtering: Reduces data processing overhead
- Respects The Graph API limits
- Intelligent retry mechanisms
- Fallback to legacy mode on errors
- Streaming data processing
- Configurable pool limits
- Efficient data structures
POOL_DISCOVERY_CONFIG = {
"min_tvl_usd": 10000, # Minimum TVL threshold
"min_tx_count": 100, # Minimum transaction count
"max_pools": 1000, # Maximum pools to analyze
"batch_size": 1000, # Batch size for pagination
"update_interval": 300, # Update interval (seconds)
}RISK_CONFIG = {
"risk_weights": {
"liquidity_risk": 0.25, # TVL volatility, concentration
"market_risk": 0.30, # Price impact, impermanent loss
"operational_risk": 0.20, # Fee efficiency, transaction frequency
"systemic_risk": 0.25, # Token ecosystem health
}
}- Critical Risk: Pools with risk score > 0.8
- High Risk: Pools with risk score > 0.6
- Volume Anomalies: Extreme volume/TVL ratios
- Volatility Alerts: High TVL volatility detection
- Pool creation detection
- Risk threshold monitoring
- Performance alerts
- System health monitoring
The system maintains backward compatibility with the original hardcoded pool approach:
- Legacy Mode: Use the original 3 hardcoded pools
- Dynamic Mode: Automatically discover all pools (default)
- Hybrid Mode: Combine both approaches
Switch between modes using the dashboard sidebar controls.
- The Graph Uniswap V3 Subgraph: Official, public subgraph
- Infura: Ethereum mainnet access (optional)
- Redis: Local caching and persistence
- Cross-reference subgraph data with on-chain data
- Validate token information and pool metadata
- Filter out invalid or suspicious pools
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
For issues, questions, or contributions:
- Create an issue on GitHub
- Check the documentation
- Review the configuration options
Built for the DeFi community