Completed clean root directory structure: - Root now contains only: .git, .env, docs/, orig/ - Moved all remaining files and directories to orig/: - Config files (.claude, .dockerignore, .drone.yml, etc.) - All .env variants (except active .env) - Git config (.gitconfig, .github, .gitignore, etc.) - Tool configs (.golangci.yml, .revive.toml, etc.) - Documentation (*.md files, @prompts) - Build files (Dockerfiles, Makefile, go.mod, go.sum) - Docker compose files - All source directories (scripts, tests, tools, etc.) - Runtime directories (logs, monitoring, reports) - Dependency files (node_modules, lib, cache) - Special files (--delete) - Removed empty runtime directories (bin/, data/) V2 structure is now clean: - docs/planning/ - V2 planning documents - orig/ - Complete V1 codebase preserved - .env - Active environment config (not in git) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
70 lines
2.2 KiB
Go
70 lines
2.2 KiB
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"flag"
|
|
"fmt"
|
|
"log"
|
|
"os"
|
|
"time"
|
|
|
|
"github.com/fraktal/mev-beta/tools/opportunity-validator/internal"
|
|
)
|
|
|
|
func main() {
|
|
var (
|
|
exchanges = flag.String("exchanges", "uniswap_v2,uniswap_v3,curve,balancer", "Comma-separated list of exchanges")
|
|
minProfitBP = flag.Float64("min-profit", 10.0, "Minimum profit threshold in basis points")
|
|
maxSlippage = flag.Float64("max-slippage", 100.0, "Maximum slippage in basis points")
|
|
outputDir = flag.String("output", "reports/opportunities", "Output directory")
|
|
verbose = flag.Bool("verbose", false, "Enable verbose output")
|
|
realtime = flag.Bool("realtime", false, "Enable real-time opportunity monitoring")
|
|
duration = flag.Duration("duration", 10*time.Minute, "Duration for real-time monitoring")
|
|
dryRun = flag.Bool("dry-run", true, "Perform dry run without actual execution")
|
|
testMode = flag.Bool("test", false, "Run in test mode with simulated data")
|
|
)
|
|
flag.Parse()
|
|
|
|
// Create output directory
|
|
if err := os.MkdirAll(*outputDir, 0755); err != nil {
|
|
log.Fatalf("Failed to create output directory: %v", err)
|
|
}
|
|
|
|
// Initialize opportunity validator
|
|
validator, err := internal.NewOpportunityValidator(&internal.ValidatorConfig{
|
|
Exchanges: *exchanges,
|
|
MinProfitBP: *minProfitBP,
|
|
MaxSlippage: *maxSlippage,
|
|
OutputDir: *outputDir,
|
|
Verbose: *verbose,
|
|
DryRun: *dryRun,
|
|
TestMode: *testMode,
|
|
})
|
|
if err != nil {
|
|
log.Fatalf("Failed to initialize validator: %v", err)
|
|
}
|
|
|
|
ctx := context.Background()
|
|
|
|
if *realtime {
|
|
fmt.Printf("Starting real-time opportunity validation for %v...\n", *duration)
|
|
ctx, cancel := context.WithTimeout(ctx, *duration)
|
|
defer cancel()
|
|
|
|
if err := validator.MonitorOpportunities(ctx); err != nil {
|
|
log.Fatalf("Real-time monitoring failed: %v", err)
|
|
}
|
|
} else {
|
|
fmt.Printf("Running opportunity validation audit...\n")
|
|
if err := validator.ValidateOpportunities(ctx); err != nil {
|
|
log.Fatalf("Opportunity validation failed: %v", err)
|
|
}
|
|
|
|
if err := validator.GenerateReport(); err != nil {
|
|
log.Fatalf("Report generation failed: %v", err)
|
|
}
|
|
}
|
|
|
|
fmt.Printf("Opportunity validation complete. Reports saved to: %s\n", *outputDir)
|
|
}
|