#!/bin/bash # MEV Bot Testing Environment Setup # This script sets up a forked Arbitrum environment for testing set -e echo "🚀 Setting up MEV Bot testing environment..." # Configuration ARBITRUM_RPC_URL="https://arb1.arbitrum.io/rpc" FORK_BLOCK_NUMBER="latest" ANVIL_PORT="8545" ANVIL_CHAIN_ID="31337" # Directories TEST_DIR="./tests" CONTRACTS_DIR="./tests/contracts" SCENARIOS_DIR="./tests/scenarios" LOGS_DIR="./tests/logs" # Create test directories mkdir -p "$TEST_DIR" mkdir -p "$CONTRACTS_DIR" mkdir -p "$SCENARIOS_DIR" mkdir -p "$LOGS_DIR" echo "📁 Created test directory structure" # Check if Foundry is installed if ! command -v forge &> /dev/null; then echo "❌ Foundry not found. Please install Foundry first:" echo " curl -L https://foundry.paradigm.xyz | bash" echo " foundryup" exit 1 fi if ! command -v anvil &> /dev/null; then echo "❌ Anvil not found. Please install Foundry first:" exit 1 fi echo "✅ Foundry installation verified" # Create foundry.toml configuration cat > foundry.toml << EOF [profile.default] src = "tests/contracts" out = "tests/out" libs = ["lib"] test = "tests" cache_path = "tests/cache" force = false [profile.default.optimizer] enabled = true runs = 200 [profile.default.fmt] line_length = 120 tab_width = 4 [rpc_endpoints] arbitrum = "$ARBITRUM_RPC_URL" local = "http://localhost:$ANVIL_PORT" EOF echo "⚙️ Created foundry.toml configuration" echo "✅ Test environment setup complete!" echo "" echo "🎯 Next steps:" echo "1. Install Foundry: curl -L https://foundry.paradigm.xyz | bash && foundryup" echo "2. Run: source tests/setup_env.sh" echo "3. Run: cd tests/scenarios && ./run_tests.sh" echo "" echo "📊 The testing environment includes:" echo " - Forked Arbitrum network with Anvil" echo " - Solidity contracts for realistic scenarios" echo " - Go integration tests" echo " - Automated test runner" echo " - Comprehensive logging"