Files
mev-beta/orig/scripts/analyze-valid-failing-pools.sh
Administrator c54c569f30 refactor: move all remaining files to orig/ directory
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>
2025-11-10 10:53:05 +01:00

110 lines
4.0 KiB
Bash
Executable File

#!/bin/bash
echo "Analyzing 171 Valid Failing Pools"
echo "=================================="
echo ""
# Get the valid pools from cleaned blacklist
POOLS=$(cat logs/pool_blacklist.json | jq -r '.[].address' | head -30)
echo "Testing first 30 valid failing pools to identify exchange types..."
echo ""
RPC="https://arb1.arbitrum.io/rpc"
UNISWAP_V3=0
UNISWAP_V2=0
SUSHISWAP=0
OTHER=0
UNKNOWN=0
for POOL in $POOLS; do
echo "Analyzing $POOL:"
# Test UniswapV3 methods
TOKEN0=$(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"')
TOKEN1=$(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"')
# Check fee() for V3
FEE=$(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"')
# Check getReserves() for V2
RESERVES=$(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"')
# Check slot0() for V3
SLOT0=$(curl -s -X POST $RPC \
-H "Content-Type: application/json" \
-d "{\"jsonrpc\":\"2.0\",\"method\":\"eth_call\",\"params\":[{\"to\":\"$POOL\",\"data\":\"0x3850c7bd\"},\"latest\"],\"id\":1}" \
| jq -r '.result // "error"')
# Analyze results
if [[ "$TOKEN0" == "0x"* ]] && [[ "$TOKEN1" == "0x"* ]]; then
if [[ "$FEE" == "0x"* ]] && [[ "$SLOT0" == "0x"* ]]; then
echo " ✅ UniswapV3 Pool (has token0, token1, fee, slot0)"
UNISWAP_V3=$((UNISWAP_V3 + 1))
# Decode the fee to see what tier
if [[ "$FEE" == "0x"* ]]; then
FEE_INT=$((16#${FEE:2}))
echo " Fee tier: $FEE_INT ($(echo "scale=2; $FEE_INT/10000" | bc)%)"
fi
# Decode tokens
TOKEN0_ADDR="0x${TOKEN0: -40}"
TOKEN1_ADDR="0x${TOKEN1: -40}"
echo " Token0: $TOKEN0_ADDR"
echo " Token1: $TOKEN1_ADDR"
elif [[ "$RESERVES" == "0x"* ]] && [[ ${#RESERVES} -gt 66 ]]; then
echo " ✅ UniswapV2/Sushiswap Pool (has token0, token1, getReserves)"
UNISWAP_V2=$((UNISWAP_V2 + 1))
else
echo " ⚠️ Has token0/token1 but unknown type"
UNKNOWN=$((UNKNOWN + 1))
fi
else
# Try other DEX signatures
echo " ❌ Not Uniswap - checking other protocols..."
# Check for Balancer vault getPoolTokens
BALANCER=$(curl -s -X POST $RPC \
-H "Content-Type: application/json" \
-d "{\"jsonrpc\":\"2.0\",\"method\":\"eth_call\",\"params\":[{\"to\":\"$POOL\",\"data\":\"0xf94d4668\"},\"latest\"],\"id\":1}" \
| jq -r '.result // "error"')
if [[ "$BALANCER" != "error" ]] && [[ "$BALANCER" == "0x"* ]]; then
echo " ✅ Possibly Balancer Pool"
OTHER=$((OTHER + 1))
else
echo " ❓ Unknown DEX type"
UNKNOWN=$((UNKNOWN + 1))
fi
fi
echo ""
done
echo "Summary of 30 Analyzed Pools"
echo "============================="
echo "UniswapV3: $UNISWAP_V3"
echo "UniswapV2/Sushi: $UNISWAP_V2"
echo "Other DEX: $OTHER"
echo "Unknown: $UNKNOWN"
echo ""
echo "Checking original error reasons from blacklist..."
echo "================================================="
cat logs/pool_blacklist.json | jq '[.[] | select(.is_blacklisted == true)] | group_by(.last_reason) | map({reason: .[0].last_reason, count: length})' | jq -r '.[] | "\(.reason): \(.count)"'