feat: create v2-prep branch with comprehensive planning

Restructured project for V2 refactor:

**Structure Changes:**
- Moved all V1 code to orig/ folder (preserved with git mv)
- Created docs/planning/ directory
- Added orig/README_V1.md explaining V1 preservation

**Planning Documents:**
- 00_V2_MASTER_PLAN.md: Complete architecture overview
  - Executive summary of critical V1 issues
  - High-level component architecture diagrams
  - 5-phase implementation roadmap
  - Success metrics and risk mitigation

- 07_TASK_BREAKDOWN.md: Atomic task breakdown
  - 99+ hours of detailed tasks
  - Every task < 2 hours (atomic)
  - Clear dependencies and success criteria
  - Organized by implementation phase

**V2 Key Improvements:**
- Per-exchange parsers (factory pattern)
- Multi-layer strict validation
- Multi-index pool cache
- Background validation pipeline
- Comprehensive observability

**Critical Issues Addressed:**
- Zero address tokens (strict validation + cache enrichment)
- Parsing accuracy (protocol-specific parsers)
- No audit trail (background validation channel)
- Inefficient lookups (multi-index cache)
- Stats disconnection (event-driven metrics)

Next Steps:
1. Review planning documents
2. Begin Phase 1: Foundation (P1-001 through P1-010)
3. Implement parsers in Phase 2
4. Build cache system in Phase 3
5. Add validation pipeline in Phase 4
6. Migrate and test in Phase 5

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Administrator
2025-11-10 10:14:26 +01:00
parent 1773daffe7
commit 803de231ba
411 changed files with 20390 additions and 8680 deletions

109
orig/config/config.dev.yaml Normal file
View File

@@ -0,0 +1,109 @@
# MEV Bot Development Configuration
# Arbitrum node configuration
arbitrum:
# RPC endpoint for Arbitrum node (using public endpoint for development)
rpc_endpoint: "https://arb1.arbitrum.io/rpc"
# WebSocket endpoint for Arbitrum node - CRITICAL FIX: Use HTTP instead of WSS to avoid 403
# The Chainstack WSS endpoint in .env returns 403 Forbidden
# Using empty string will make bot use RPC endpoint for both HTTP and WS
ws_endpoint: ""
# Chain ID for Arbitrum (42161 for mainnet)
chain_id: 42161
# Rate limiting configuration for RPC endpoint
# CRITICAL FIX: Reduced limits to prevent 429 errors on public endpoints
rate_limit:
# Maximum requests per second (reduced from 5 to 2 for public endpoint)
requests_per_second: 2
# Maximum concurrent requests (reduced from 3 to 1)
max_concurrent: 1
# Burst size for rate limiting (reduced from 10 to 3)
burst: 3
# Fallback RPC endpoints - Multiple endpoints for redundancy
fallback_endpoints:
- url: "https://arbitrum-rpc.publicnode.com"
rate_limit:
requests_per_second: 1
max_concurrent: 1
burst: 2
- url: "https://1rpc.io/arb"
rate_limit:
requests_per_second: 1
max_concurrent: 1
burst: 2
- url: "https://arbitrum.llamarpc.com"
rate_limit:
requests_per_second: 1
max_concurrent: 1
burst: 2
# Bot configuration
bot:
# Enable or disable the bot
enabled: true
# Polling interval in seconds (reduced to lower RPC request rate)
polling_interval: 5
# Minimum profit threshold in USD
min_profit_threshold: 5.0
# Gas price multiplier (for faster transactions)
gas_price_multiplier: 1.2
# Maximum number of concurrent workers for processing (reduced from 5 to 3)
max_workers: 3
# Buffer size for channels
channel_buffer_size: 50
# Timeout for RPC calls in seconds (increased from 30 to 60 for better retry handling)
rpc_timeout: 60
# Uniswap configuration
uniswap:
# Factory contract address
factory_address: "0x1F98431c8aD98523631AE4a59f267346ea31F984"
# Position manager contract address
position_manager_address: "0xC36442b4a4522E871399CD717aBDD847Ab11FE88"
# Supported fee tiers
fee_tiers:
- 500 # 0.05%
- 3000 # 0.3%
- 10000 # 1%
# Cache configuration for pool data
cache:
# Enable or disable caching
enabled: true
# Cache expiration time in seconds (increased from 300 to 600 to reduce RPC calls)
expiration: 600
# Maximum cache size (increased from 1000 to 2000)
max_size: 2000
# Logging configuration
log:
# Log level (debug, info, warn, error)
level: "debug"
# Log format (json, text)
format: "text"
# Log file path (empty for stdout)
file: ""
# Database configuration
database:
# Database file path
file: "data/mev-bot.db"
# Maximum number of open connections
max_open_connections: 5
# Maximum number of idle connections
max_idle_connections: 2
# Arbitrage configuration
arbitrage:
# Enable or disable arbitrage service
enabled: true
# Minimum profit threshold in USD
min_profit: 1.0
# Maximum position size in USD
max_position_size: 1000.0
# Gas price limit in gwei
max_gas_price: 100
# Minimum swap size to trigger arbitrage detection (in wei)
min_significant_swap_size: 10000000000000000 # 0.01 ETH
# Minimum scan amount (in wei) - CRITICAL FIX for amount=0 bug
min_scan_amount_wei: 10000000000000000 # 0.01 ETH minimum
# Maximum scan amount (in wei) - fits in int64 (max 9.2e18)
max_scan_amount_wei: 9000000000000000000 # 9 ETH maximum (fits int64)