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>
This commit is contained in:
153
orig/scripts/check-wallet-balance.sh
Executable file
153
orig/scripts/check-wallet-balance.sh
Executable file
@@ -0,0 +1,153 @@
|
||||
#!/usr/bin/env bash
|
||||
# Check wallet balance on Arbitrum One
|
||||
# Verifies wallet is ready for MEV bot execution
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
PRIVATE_KEY_FILE="/tmp/wallet_key.txt"
|
||||
ALCHEMY_RPC="https://arb-mainnet.g.alchemy.com/v2/d6VAHgzkOI3NgLGem6uBMiADT1E9rROB"
|
||||
MIN_BALANCE_ETH="0.001"
|
||||
|
||||
echo "═══════════════════════════════════════════════════════════"
|
||||
echo "💰 MEV Bot Wallet Balance Check"
|
||||
echo "═══════════════════════════════════════════════════════════"
|
||||
echo ""
|
||||
|
||||
# Check if private key file exists
|
||||
if [ ! -f "$PRIVATE_KEY_FILE" ]; then
|
||||
echo "❌ Error: Private key file not found at $PRIVATE_KEY_FILE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PRIVATE_KEY=$(cat "$PRIVATE_KEY_FILE")
|
||||
|
||||
# Derive wallet address
|
||||
echo "🔍 Deriving wallet address..."
|
||||
|
||||
if command -v cast &> /dev/null; then
|
||||
WALLET_ADDRESS=$(cast wallet address "$PRIVATE_KEY")
|
||||
elif command -v python3 &> /dev/null; then
|
||||
WALLET_ADDRESS=$(python3 << 'EOF'
|
||||
try:
|
||||
from eth_account import Account
|
||||
import sys
|
||||
|
||||
with open('/tmp/wallet_key.txt', 'r') as f:
|
||||
private_key = f.read().strip()
|
||||
|
||||
if private_key.startswith('0x'):
|
||||
private_key = private_key[2:]
|
||||
|
||||
account = Account.from_key(bytes.fromhex(private_key))
|
||||
print(account.address)
|
||||
except Exception as e:
|
||||
print(f"Error: {e}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
EOF
|
||||
)
|
||||
else
|
||||
echo "❌ Error: Neither cast nor python3 available"
|
||||
echo " Please install Foundry or Python with eth_account"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✅ Wallet Address: $WALLET_ADDRESS"
|
||||
echo ""
|
||||
|
||||
# Query balance from Arbitrum
|
||||
echo "🌐 Querying Arbitrum One network..."
|
||||
|
||||
BALANCE_HEX=$(curl -s -X POST "$ALCHEMY_RPC" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBalance\",\"params\":[\"$WALLET_ADDRESS\",\"latest\"],\"id\":1}" | \
|
||||
grep -o '"result":"[^"]*"' | \
|
||||
cut -d'"' -f4)
|
||||
|
||||
if [ -z "$BALANCE_HEX" ]; then
|
||||
echo "❌ Error: Failed to query balance from Arbitrum"
|
||||
echo " RPC endpoint may be unavailable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Convert hex to decimal (wei)
|
||||
# Handle both with and without 0x prefix
|
||||
if [[ "$BALANCE_HEX" == 0x* ]]; then
|
||||
BALANCE_WEI=$((BALANCE_HEX))
|
||||
else
|
||||
BALANCE_WEI=$((0x$BALANCE_HEX))
|
||||
fi
|
||||
|
||||
# Convert wei to ETH (1 ETH = 10^18 wei)
|
||||
BALANCE_ETH=$(echo "scale=6; $BALANCE_WEI / 1000000000000000000" | bc)
|
||||
|
||||
echo "✅ Balance Retrieved"
|
||||
echo ""
|
||||
|
||||
# Display balance
|
||||
echo "═══════════════════════════════════════════════════════════"
|
||||
echo "💰 Current Balance"
|
||||
echo "═══════════════════════════════════════════════════════════"
|
||||
echo ""
|
||||
echo " Address: $WALLET_ADDRESS"
|
||||
echo " Network: Arbitrum One (Chain ID: 42161)"
|
||||
echo " Balance: $BALANCE_ETH ETH"
|
||||
echo " Value: ~\$$(echo "scale=2; $BALANCE_ETH * 2000" | bc) USD (at \$2000/ETH)"
|
||||
echo ""
|
||||
|
||||
# Check if balance meets minimum
|
||||
BALANCE_CHECK=$(echo "$BALANCE_ETH >= $MIN_BALANCE_ETH" | bc)
|
||||
|
||||
if [ "$BALANCE_CHECK" -eq 1 ]; then
|
||||
echo "✅ Wallet is funded and ready for execution!"
|
||||
echo ""
|
||||
|
||||
# Calculate estimated trades
|
||||
TRADES=$(echo "scale=0; $BALANCE_ETH / 0.0005" | bc)
|
||||
echo "📊 Estimated Capacity:"
|
||||
echo " • Max gas per trade: ~\$1.00 (~0.0005 ETH)"
|
||||
echo " • Estimated trades: ~$TRADES transactions"
|
||||
echo " • Recommended refill: When balance < 0.0005 ETH"
|
||||
echo ""
|
||||
|
||||
echo "⏭️ Next Steps:"
|
||||
echo " 1. Run: ./scripts/setup-keystore.sh"
|
||||
echo " 2. Enable execution mode in config"
|
||||
echo " 3. Restart bot to begin trading"
|
||||
echo ""
|
||||
|
||||
# Arbiscan link
|
||||
echo "🔗 View on Arbiscan:"
|
||||
echo " https://arbiscan.io/address/$WALLET_ADDRESS"
|
||||
echo ""
|
||||
|
||||
exit 0
|
||||
else
|
||||
echo "⚠️ Wallet balance is below minimum threshold"
|
||||
echo ""
|
||||
echo "❌ Current: $BALANCE_ETH ETH"
|
||||
echo "✅ Required: $MIN_BALANCE_ETH ETH"
|
||||
echo "📉 Deficit: $(echo "scale=6; $MIN_BALANCE_ETH - $BALANCE_ETH" | bc) ETH"
|
||||
echo ""
|
||||
echo "💡 Funding Instructions:"
|
||||
echo ""
|
||||
echo " **Option 1: Bridge from Ethereum**"
|
||||
echo " • Visit: https://bridge.arbitrum.io/"
|
||||
echo " • Bridge 0.001-0.005 ETH from Ethereum to Arbitrum"
|
||||
echo " • Wait 7-15 minutes for confirmation"
|
||||
echo ""
|
||||
echo " **Option 2: Exchange Withdrawal**"
|
||||
echo " • Go to Coinbase/Binance/Kraken"
|
||||
echo " • Withdraw → ETH → Select 'Arbitrum One' network"
|
||||
echo " • Send to: $WALLET_ADDRESS"
|
||||
echo " • Amount: 0.001-0.005 ETH"
|
||||
echo ""
|
||||
echo " **Option 3: From Existing Arbitrum Wallet**"
|
||||
echo " • Open MetaMask on Arbitrum One network"
|
||||
echo " • Send 0.001-0.005 ETH to: $WALLET_ADDRESS"
|
||||
echo ""
|
||||
echo "🔗 Track transaction:"
|
||||
echo " https://arbiscan.io/address/$WALLET_ADDRESS"
|
||||
echo ""
|
||||
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user