#!/bin/bash echo "Testing UniswapV3 Pools with Anvil Fork" echo "========================================" echo "" # Kill any existing anvil processes pkill anvil 2>/dev/null echo "Starting Anvil fork of Arbitrum mainnet..." anvil --fork-url https://arb1.arbitrum.io/rpc \ --fork-block-number latest \ --port 8545 \ --silent & ANVIL_PID=$! echo "Anvil started with PID: $ANVIL_PID" # Wait for Anvil to be ready sleep 3 echo "" echo "Testing Known UniswapV3 Pools" echo "==============================" # Known good UniswapV3 pools on Arbitrum POOLS=( "0xC31E54c7a869B9FcBEcc14363CF510d1c41fa443" # WETH/USDC.e 0.05% "0x641C00A822e8b671738d32a431a4Fb6074E5c79d" # USDT/WETH 0.05% "0x2f5e87C9312fa29aed5c179E456625D79015299c" # WBTC/WETH 0.05% "0x6f38e884725a116C9C7fBF208e79FE8828a2595F" # WETH/USDC 0.05% (native USDC) ) # Test each pool for POOL in "${POOLS[@]}"; do echo "" echo "Testing pool: $POOL" echo "----------------------------------------" # token0() echo -n " token0(): " TOKEN0=$(cast call $POOL "token0()(address)" --rpc-url http://localhost:8545 2>/dev/null) if [ $? -eq 0 ]; then echo "✅ $TOKEN0" else echo "❌ Failed" fi # token1() echo -n " token1(): " TOKEN1=$(cast call $POOL "token1()(address)" --rpc-url http://localhost:8545 2>/dev/null) if [ $? -eq 0 ]; then echo "✅ $TOKEN1" else echo "❌ Failed" fi # fee() echo -n " fee(): " FEE=$(cast call $POOL "fee()(uint24)" --rpc-url http://localhost:8545 2>/dev/null) if [ $? -eq 0 ]; then echo "✅ $FEE" else echo "❌ Failed" fi # liquidity() echo -n " liquidity(): " LIQUIDITY=$(cast call $POOL "liquidity()(uint128)" --rpc-url http://localhost:8545 2>/dev/null) if [ $? -eq 0 ]; then echo "✅ Has liquidity" else echo "❌ Failed" fi # slot0() echo -n " slot0(): " SLOT0=$(cast call $POOL "slot0()(uint160,int24,uint16,uint16,uint16,uint8,bool)" --rpc-url http://localhost:8545 2>/dev/null) if [ $? -eq 0 ]; then echo "✅ Returns slot0 data" else echo "❌ Failed" fi done echo "" echo "Testing Blacklisted Pools" echo "=========================" # Get some blacklisted pools BLACKLISTED=( "0x7760cfd39f8fc36239c7299851d8b334cc5acbed" "0xe0571fecab07216cae82a0af3f44e7ea7aff8426" "0x8d17b1ce5132b327981dcea21cb183b9a3e1c177" ) for POOL in "${BLACKLISTED[@]}"; do echo "" echo "Testing blacklisted pool: $POOL" echo "----------------------------------------" # Check if contract exists echo -n " Contract exists: " CODE=$(cast code $POOL --rpc-url http://localhost:8545 2>/dev/null) if [ ! -z "$CODE" ] && [ "$CODE" != "0x" ]; then echo "✅ Yes (${#CODE} chars)" else echo "❌ No contract" continue fi # Try token0() echo -n " token0(): " TOKEN0=$(cast call $POOL "token0()(address)" --rpc-url http://localhost:8545 2>&1) if [[ "$TOKEN0" == *"0x"* ]] && [[ ! "$TOKEN0" == *"revert"* ]]; then echo "✅ $TOKEN0" else echo "❌ $(echo $TOKEN0 | head -c 50)" fi # Try token1() echo -n " token1(): " TOKEN1=$(cast call $POOL "token1()(address)" --rpc-url http://localhost:8545 2>&1) if [[ "$TOKEN1" == *"0x"* ]] && [[ ! "$TOKEN1" == *"revert"* ]]; then echo "✅ $TOKEN1" else echo "❌ $(echo $TOKEN1 | head -c 50)" fi done # Kill anvil echo "" echo "Cleaning up..." kill $ANVIL_PID 2>/dev/null echo "" echo "Test complete!"