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>
77 lines
2.2 KiB
Bash
Executable File
77 lines
2.2 KiB
Bash
Executable File
#!/bin/bash
|
|
# Pre-Run Validation Script
|
|
# Validates environment before starting MEV bot
|
|
|
|
set -e
|
|
|
|
echo "========================================="
|
|
echo "MEV Bot Pre-Run Validation"
|
|
echo "========================================="
|
|
|
|
ERRORS=0
|
|
|
|
# Check RPC endpoints
|
|
echo "[1/5] Checking RPC endpoints..."
|
|
if [ -z "$ARBITRUM_RPC_ENDPOINT" ]; then
|
|
echo "❌ ARBITRUM_RPC_ENDPOINT not set"
|
|
ERRORS=$((ERRORS + 1))
|
|
else
|
|
echo "✅ ARBITRUM_RPC_ENDPOINT: $ARBITRUM_RPC_ENDPOINT"
|
|
fi
|
|
|
|
# Check for wss:// or https:// prefix
|
|
echo "[2/5] Validating endpoint format..."
|
|
if [[ "$ARBITRUM_RPC_ENDPOINT" == wss://* ]] || [[ "$ARBITRUM_RPC_ENDPOINT" == https://* ]]; then
|
|
echo "✅ Endpoint format valid"
|
|
else
|
|
echo "❌ Endpoint must start with wss:// or https://"
|
|
ERRORS=$((ERRORS + 1))
|
|
fi
|
|
|
|
# Check log directory
|
|
echo "[3/5] Checking log directory..."
|
|
if [ -d "logs" ]; then
|
|
echo "✅ Log directory exists"
|
|
|
|
# Check for excessive zero addresses in recent logs
|
|
if [ -f "logs/liquidity_events_$(date +%Y-%m-%d).jsonl" ]; then
|
|
ZERO_COUNT=$(grep -c "0x0000000000000000000000000000000000000000" "logs/liquidity_events_$(date +%Y-%m-%d).jsonl" 2>/dev/null || echo 0)
|
|
echo "Zero addresses in today's events: $ZERO_COUNT"
|
|
if [ "$ZERO_COUNT" -gt 10 ]; then
|
|
echo "⚠️ WARNING: High zero address count detected"
|
|
fi
|
|
fi
|
|
else
|
|
mkdir -p logs
|
|
echo "✅ Created log directory"
|
|
fi
|
|
|
|
# Check binary exists
|
|
echo "[4/5] Checking binary..."
|
|
if [ -f "./mev-bot" ] || [ -f "./bin/mev-bot" ]; then
|
|
echo "✅ MEV bot binary found"
|
|
else
|
|
echo "❌ MEV bot binary not found. Run 'make build' first"
|
|
ERRORS=$((ERRORS + 1))
|
|
fi
|
|
|
|
# Check for port conflicts
|
|
echo "[5/5] Checking for port conflicts..."
|
|
if lsof -Pi :9090 -sTCP:LISTEN -t >/dev/null 2>&1; then
|
|
echo "⚠️ WARNING: Port 9090 (metrics) already in use"
|
|
fi
|
|
|
|
if lsof -Pi :8080 -sTCP:LISTEN -t >/dev/null 2>&1; then
|
|
echo "⚠️ WARNING: Port 8080 (dashboard) already in use"
|
|
fi
|
|
|
|
echo ""
|
|
echo "========================================="
|
|
if [ $ERRORS -eq 0 ]; then
|
|
echo "✅ Validation PASSED - Safe to start"
|
|
exit 0
|
|
else
|
|
echo "❌ Validation FAILED - $ERRORS error(s) found"
|
|
exit 1
|
|
fi
|