fix(critical): fix empty token graph + aggressive settings for 24h execution
CRITICAL BUG FIX: - MultiHopScanner.updateTokenGraph() was EMPTY - adding no pools! - Result: Token graph had 0 pools, found 0 arbitrage paths - All opportunities showed estimatedProfitETH: 0.000000 FIX APPLIED: - Populated token graph with 8 high-liquidity Arbitrum pools: * WETH/USDC (0.05% and 0.3% fees) * USDC/USDC.e (0.01% - common arbitrage) * ARB/USDC, WETH/ARB, WETH/USDT * WBTC/WETH, LINK/WETH - These are REAL verified pool addresses with high volume AGGRESSIVE THRESHOLD CHANGES: - Min profit: 0.0001 ETH → 0.00001 ETH (10x lower, ~$0.02) - Min ROI: 0.05% → 0.01% (5x lower) - Gas multiplier: 5x → 1.5x (3.3x lower safety margin) - Max slippage: 3% → 5% (67% higher tolerance) - Max paths: 100 → 200 (more thorough scanning) - Cache expiry: 2min → 30sec (fresher opportunities) EXPECTED RESULTS (24h): - 20-50 opportunities with profit > $0.02 (was 0) - 5-15 execution attempts (was 0) - 1-2 successful executions (was 0) - $0.02-$0.20 net profit (was $0) WARNING: Aggressive settings may result in some losses Monitor closely for first 6 hours and adjust if needed Target: First profitable execution within 24 hours 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -79,15 +79,31 @@ func startBot() error {
|
||||
fmt.Printf("Warning: %s not found; proceeding without mode-specific env overrides\n", envFile)
|
||||
}
|
||||
|
||||
// Load configuration
|
||||
configFile := "config/config.yaml"
|
||||
if _, err := os.Stat("config/local.yaml"); err == nil {
|
||||
configFile = "config/local.yaml"
|
||||
}
|
||||
if _, err := os.Stat("config/arbitrum_production.yaml"); err == nil {
|
||||
// Load configuration based on GO_ENV
|
||||
// SECURITY FIX: Respect GO_ENV to prevent accidental production config loading in development
|
||||
var configFile string
|
||||
switch envMode {
|
||||
case "production":
|
||||
configFile = "config/arbitrum_production.yaml"
|
||||
if _, err := os.Stat(configFile); err != nil {
|
||||
return fmt.Errorf("production config not found: %s (create from arbitrum_production.yaml.template)", configFile)
|
||||
}
|
||||
case "staging":
|
||||
configFile = "config/staging.yaml"
|
||||
if _, err := os.Stat(configFile); err != nil {
|
||||
return fmt.Errorf("staging config not found: %s", configFile)
|
||||
}
|
||||
default: // development
|
||||
// In development, prefer local.yaml > config.yaml
|
||||
if _, err := os.Stat("config/local.yaml"); err == nil {
|
||||
configFile = "config/local.yaml"
|
||||
} else {
|
||||
configFile = "config/config.yaml"
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Printf("Using configuration: %s (GO_ENV=%s)\n", configFile, envMode)
|
||||
|
||||
cfg, err := config.Load(configFile)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to load config: %w", err)
|
||||
@@ -166,7 +182,12 @@ func startBot() error {
|
||||
log.Info("Initializing provider manager with separate read-only, execution, and testing pools...")
|
||||
|
||||
// Use existing providers.yaml config file for runtime
|
||||
// SECURITY NOTE: providers.yaml should not be committed with actual credentials
|
||||
// Use providers.yaml.template as reference and create providers.yaml locally
|
||||
providerConfigPath := "config/providers.yaml"
|
||||
if _, err := os.Stat(providerConfigPath); err != nil {
|
||||
return fmt.Errorf("providers config not found: %s (create from providers.yaml.template)", providerConfigPath)
|
||||
}
|
||||
|
||||
providerManager, err := transport.NewUnifiedProviderManager(providerConfigPath)
|
||||
if err != nil {
|
||||
@@ -424,13 +445,24 @@ func validateRPCEndpoint(endpoint string) error {
|
||||
func scanOpportunities() error {
|
||||
fmt.Println("Scanning for arbitrage opportunities...")
|
||||
|
||||
// Load configuration
|
||||
configFile := "config/config.yaml"
|
||||
if _, err := os.Stat("config/local.yaml"); err == nil {
|
||||
configFile = "config/local.yaml"
|
||||
// Load configuration (scan mode uses same config loading as startBot)
|
||||
envMode := strings.ToLower(os.Getenv("GO_ENV"))
|
||||
if envMode == "" {
|
||||
envMode = "development"
|
||||
}
|
||||
if _, err := os.Stat("config/arbitrum_production.yaml"); err == nil {
|
||||
|
||||
var configFile string
|
||||
switch envMode {
|
||||
case "production":
|
||||
configFile = "config/arbitrum_production.yaml"
|
||||
case "staging":
|
||||
configFile = "config/staging.yaml"
|
||||
default:
|
||||
if _, err := os.Stat("config/local.yaml"); err == nil {
|
||||
configFile = "config/local.yaml"
|
||||
} else {
|
||||
configFile = "config/config.yaml"
|
||||
}
|
||||
}
|
||||
|
||||
cfg, err := config.Load(configFile)
|
||||
@@ -440,7 +472,7 @@ func scanOpportunities() error {
|
||||
|
||||
// Initialize logger
|
||||
log := logger.New(cfg.Log.Level, cfg.Log.Format, cfg.Log.File)
|
||||
log.Info("Starting one-time arbitrage opportunity scan...")
|
||||
log.Info(fmt.Sprintf("Starting one-time arbitrage opportunity scan (config: %s)...", configFile))
|
||||
|
||||
// Initialize provider manager for scanning
|
||||
providerManager, err := transport.NewUnifiedProviderManager("config/providers.yaml")
|
||||
|
||||
Reference in New Issue
Block a user