Files
mev-beta/orig/scripts/clean-blacklist.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

105 lines
2.9 KiB
Bash
Executable File

#!/bin/bash
echo "Cleaning Pool Blacklist - Removing Invalid Addresses"
echo "===================================================="
echo ""
# Backup the current blacklist
cp logs/pool_blacklist.json logs/pool_blacklist.json.backup.$(date +%Y%m%d_%H%M%S)
echo "✅ Backed up current blacklist"
# Create a temporary file for valid pools
TEMP_FILE="/tmp/valid_pools.json"
echo "[]" > $TEMP_FILE
# RPC endpoint
RPC="https://arb1.arbitrum.io/rpc"
# Get all blacklisted pools
POOLS=$(cat logs/pool_blacklist.json | jq -r '.[] | .address')
TOTAL=0
VALID=0
INVALID=0
echo ""
echo "Checking each pool for contract existence..."
echo ""
for POOL in $POOLS; do
TOTAL=$((TOTAL + 1))
# Check if 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" ]] && [[ ${#CODE} -gt 10 ]]; then
# Contract exists - keep in blacklist
ENTRY=$(cat logs/pool_blacklist.json | jq --arg addr "$POOL" '.[] | select(.address == $addr)')
if [ ! -z "$ENTRY" ]; then
echo "$ENTRY" | jq -s '.' | jq '.[0]' >> $TEMP_FILE.tmp
VALID=$((VALID + 1))
echo "$POOL - Valid contract ($(( ${#CODE} / 2 - 1 )) bytes)"
fi
else
# No contract - remove from blacklist
INVALID=$((INVALID + 1))
echo "$POOL - No contract, removing"
fi
# Show progress
if [ $((TOTAL % 10)) -eq 0 ]; then
echo " Progress: $TOTAL pools checked..."
fi
done
# Combine all valid entries into a proper JSON array
if [ -f $TEMP_FILE.tmp ]; then
cat $TEMP_FILE.tmp | jq -s '.' > $TEMP_FILE
rm $TEMP_FILE.tmp
fi
echo ""
echo "Summary"
echo "======="
echo "Total pools checked: $TOTAL"
echo "Valid contracts: $VALID"
echo "Invalid (removed): $INVALID"
echo ""
# Replace the blacklist with cleaned version
if [ $VALID -gt 0 ]; then
mv $TEMP_FILE logs/pool_blacklist.json
echo "✅ Blacklist updated with $VALID valid pools"
else
echo "⚠️ No valid pools found - keeping original blacklist"
fi
echo ""
echo "Testing a few valid UniswapV3 pools to ensure they work..."
echo ""
# Test known good pools
GOOD_POOLS=(
"0xC31E54c7a869B9FcBEcc14363CF510d1c41fa443" # WETH/USDC.e
"0x641C00A822e8b671738d32a431a4Fb6074E5c79d" # USDT/WETH
)
for POOL in "${GOOD_POOLS[@]}"; do
echo -n "Testing $POOL: "
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"')
if [[ "$TOKEN0" == "0x"* ]] && [[ ${#TOKEN0} -eq 66 ]]; then
echo "✅ Works"
else
echo "❌ Failed"
fi
done
echo ""
echo "Cleanup complete!"