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:
96
scripts/deploy-flashloan-fork.sh
Executable file
96
scripts/deploy-flashloan-fork.sh
Executable file
@@ -0,0 +1,96 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Deploy FlashLoanReceiverSecure to Arbitrum Fork
|
||||
# This script deploys and tests the flash loan contract on a local fork
|
||||
|
||||
set -e
|
||||
|
||||
echo "═══════════════════════════════════════════════════════════════════"
|
||||
echo " FlashLoanReceiverSecure - Fork Deployment"
|
||||
echo "═══════════════════════════════════════════════════════════════════"
|
||||
echo ""
|
||||
|
||||
# Colors
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
RED='\033[0;31m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Balancer Vault address on Arbitrum
|
||||
BALANCER_VAULT="0xBA12222222228d8Ba445958a75a0704d566BF2C8"
|
||||
|
||||
# Default deployer (Anvil account #0)
|
||||
DEPLOYER="0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
|
||||
|
||||
echo -e "${YELLOW}📋 Configuration:${NC}"
|
||||
echo " Balancer Vault: $BALANCER_VAULT"
|
||||
echo " Deployer: $DEPLOYER"
|
||||
echo ""
|
||||
|
||||
# Check if Arbitrum RPC endpoint is set
|
||||
if [ -z "$ARBITRUM_RPC_URL" ]; then
|
||||
echo -e "${RED}❌ Error: ARBITRUM_RPC_URL not set${NC}"
|
||||
echo " Please set: export ARBITRUM_RPC_URL='https://arb1.arbitrum.io/rpc'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${YELLOW}🔄 Starting Arbitrum fork...${NC}"
|
||||
echo " RPC: $ARBITRUM_RPC_URL"
|
||||
echo ""
|
||||
|
||||
# Start anvil fork in background
|
||||
ANVIL_LOG="/tmp/anvil-fork.log"
|
||||
anvil --fork-url "$ARBITRUM_RPC_URL" --port 8545 --chain-id 42161 > "$ANVIL_LOG" 2>&1 &
|
||||
ANVIL_PID=$!
|
||||
|
||||
# Wait for anvil to start
|
||||
sleep 3
|
||||
|
||||
# Check if anvil started successfully
|
||||
if ! kill -0 $ANVIL_PID 2>/dev/null; then
|
||||
echo -e "${RED}❌ Failed to start Anvil fork${NC}"
|
||||
cat "$ANVIL_LOG"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}✅ Anvil fork started (PID: $ANVIL_PID)${NC}"
|
||||
echo " Listening on: http://localhost:8545"
|
||||
echo " Chain ID: 42161 (Arbitrum)"
|
||||
echo ""
|
||||
|
||||
# Cleanup function
|
||||
cleanup() {
|
||||
echo ""
|
||||
echo -e "${YELLOW}🧹 Cleaning up...${NC}"
|
||||
if kill -0 $ANVIL_PID 2>/dev/null; then
|
||||
kill $ANVIL_PID
|
||||
echo -e "${GREEN}✅ Anvil fork stopped${NC}"
|
||||
fi
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
echo -e "${YELLOW}🚀 Deploying FlashLoanReceiverSecure...${NC}"
|
||||
echo ""
|
||||
|
||||
# Deploy contract using forge script
|
||||
forge script scripts/DeployFlashLoanSecure.s.sol:DeployFlashLoanSecure \
|
||||
--rpc-url http://localhost:8545 \
|
||||
--private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 \
|
||||
--broadcast \
|
||||
-vvv
|
||||
|
||||
echo ""
|
||||
echo -e "${GREEN}✅ Deployment complete!${NC}"
|
||||
echo ""
|
||||
echo -e "${YELLOW}📝 Next steps:${NC}"
|
||||
echo " 1. Note the deployed contract address above"
|
||||
echo " 2. Test flash loan execution"
|
||||
echo " 3. Verify slippage protection works"
|
||||
echo " 4. Test with real arbitrage paths"
|
||||
echo ""
|
||||
echo -e "${YELLOW}💡 Tip:${NC} Fork will keep running. Press Ctrl+C to stop."
|
||||
echo ""
|
||||
echo "═══════════════════════════════════════════════════════════════════"
|
||||
|
||||
# Keep script running
|
||||
wait $ANVIL_PID
|
||||
Reference in New Issue
Block a user