Files
mev-beta/scripts/check-pool-interface.sh

113 lines
3.6 KiB
Bash
Executable File

#!/bin/bash
echo "Checking Pool Contract Interfaces"
echo "================================="
# Test pool addresses
POOLS=(
"0x6f38e884725a116C9C7fBF208e79FE8828a2595F"
"0x2f5e87C9312fa29aed5c179E456625D79015299c"
"0xB1026b8e7276e7AC75410F1fcbbe21796e8f7526"
)
# RPC endpoint
RPC="https://arb1.arbitrum.io/rpc"
echo ""
echo "Testing standard UniswapV3 pool methods..."
echo ""
for POOL in "${POOLS[@]}"; do
echo "Pool: $POOL"
echo "-------------------------------------------"
# Test token0() - 0x0dfe1681
echo -n " token0(): "
TOKEN0_RESULT=$(curl -s -X POST $RPC \
-H "Content-Type: application/json" \
-d "{\"jsonrpc\":\"2.0\",\"method\":\"eth_call\",\"params\":[{\"to\":\"$POOL\",\"data\":\"0x0dfe1681\"},\"latest\"],\"id\":1}" \
| jq -r '.result // .error.message')
if [[ "$TOKEN0_RESULT" == "0x"* ]] && [[ ${#TOKEN0_RESULT} -eq 66 ]]; then
echo "✅ Success - $(echo $TOKEN0_RESULT | cut -c 27-66)"
else
echo "❌ Failed - $TOKEN0_RESULT"
fi
# Test token1() - 0xd21220a7
echo -n " token1(): "
TOKEN1_RESULT=$(curl -s -X POST $RPC \
-H "Content-Type: application/json" \
-d "{\"jsonrpc\":\"2.0\",\"method\":\"eth_call\",\"params\":[{\"to\":\"$POOL\",\"data\":\"0xd21220a7\"},\"latest\"],\"id\":1}" \
| jq -r '.result // .error.message')
if [[ "$TOKEN1_RESULT" == "0x"* ]] && [[ ${#TOKEN1_RESULT} -eq 66 ]]; then
echo "✅ Success - $(echo $TOKEN1_RESULT | cut -c 27-66)"
else
echo "❌ Failed - $TOKEN1_RESULT"
fi
# Test fee() - 0xddca3f43
echo -n " fee(): "
FEE_RESULT=$(curl -s -X POST $RPC \
-H "Content-Type: application/json" \
-d "{\"jsonrpc\":\"2.0\",\"method\":\"eth_call\",\"params\":[{\"to\":\"$POOL\",\"data\":\"0xddca3f43\"},\"latest\"],\"id\":1}" \
| jq -r '.result // .error.message')
if [[ "$FEE_RESULT" == "0x"* ]]; then
echo "✅ Success"
else
echo "❌ Failed - $FEE_RESULT"
fi
# Get bytecode size to check if contract exists
echo -n " Contract exists: "
CODE=$(curl -s -X POST $RPC \
-H "Content-Type: application/json" \
-d "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getCode\",\"params\":[\"$POOL\",\"latest\"],\"id\":1}" \
| jq -r '.result')
if [[ "$CODE" != "0x" ]] && [[ -n "$CODE" ]]; then
BYTES=$((${#CODE} / 2 - 1))
echo "✅ Yes ($BYTES bytes)"
else
echo "❌ No contract at this address"
fi
echo ""
done
echo "Alternative Method Signatures to Try:"
echo "======================================"
echo ""
echo "Testing Uniswap V2 style methods..."
echo ""
for POOL in "${POOLS[@]}"; do
echo "Pool: $POOL"
echo "-------------------------------------------"
# Test Uniswap V2 token0() - same selector
echo -n " V2 token0(): "
TOKEN0_RESULT=$(curl -s -X POST $RPC \
-H "Content-Type: application/json" \
-d "{\"jsonrpc\":\"2.0\",\"method\":\"eth_call\",\"params\":[{\"to\":\"$POOL\",\"data\":\"0x0dfe1681\"},\"latest\"],\"id\":1}" \
| jq -r '.result // .error.message')
echo "$TOKEN0_RESULT" | head -c 50
echo ""
# Test getReserves() for V2 - 0x0902f1ac
echo -n " getReserves(): "
RESERVES_RESULT=$(curl -s -X POST $RPC \
-H "Content-Type: application/json" \
-d "{\"jsonrpc\":\"2.0\",\"method\":\"eth_call\",\"params\":[{\"to\":\"$POOL\",\"data\":\"0x0902f1ac\"},\"latest\"],\"id\":1}" \
| jq -r '.result // .error.message')
if [[ "$RESERVES_RESULT" == "0x"* ]] && [[ ${#RESERVES_RESULT} -gt 66 ]]; then
echo "✅ V2 Pool detected"
else
echo "❌ Not a V2 pool"
fi
echo ""
done