Files
proxmox/scripts/health-check.sh

66 lines
1.9 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
set -euo pipefail
# Load IP configuration
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
source "${PROJECT_ROOT}/config/ip-addresses.conf" 2>/dev/null || true
# Comprehensive health check for bridge system
source /home/intlc/projects/smom-dbis-138/.env
RPC_URL="${RPC_URL_138_PUBLIC:-http://${RPC_PUBLIC_1:-192.168.11.221}:8545}"
echo "=== Bridge System Health Check ==="
echo ""
# Check RPC connectivity
echo "1. RPC Connectivity:"
if cast block-number --rpc-url "$RPC_URL" >/dev/null 2>&1; then
echo " ✅ RPC is accessible"
else
echo " ❌ RPC is not accessible"
fi
# Check bridge contracts
echo ""
echo "2. Bridge Contracts:"
WETH9_BRIDGE="${CCIPWETH9_BRIDGE_CHAIN138:-0x971cD9D156f193df8051E48043C476e53ECd4693}"
WETH10_BRIDGE="0xe0E93247376aa097dB308B92e6Ba36bA015535D0"
if cast code "$WETH9_BRIDGE" --rpc-url "$RPC_URL" >/dev/null 2>&1; then
echo " ✅ WETH9 Bridge deployed"
else
echo " ❌ WETH9 Bridge not found"
fi
if cast code "$WETH10_BRIDGE" --rpc-url "$RPC_URL" >/dev/null 2>&1; then
echo " ✅ WETH10 Bridge deployed"
else
echo " ❌ WETH10 Bridge not found"
fi
# Check destination chains
echo ""
echo "3. Destination Chains:"
declare -A CHAINS=(
["BSC"]="11344663589394136015"
["Polygon"]="4051577828743386545"
["Avalanche"]="6433500567565415381"
["Base"]="15971525489660198786"
["Arbitrum"]="4949039107694359620"
["Optimism"]="3734403246176062136"
["Ethereum"]="5009297550715157269"
)
for chain in "${!CHAINS[@]}"; do
selector="${CHAINS[$chain]}"
result=$(cast call "$WETH9_BRIDGE" "destinations(uint64)" "$selector" --rpc-url "$RPC_URL" 2>/dev/null || echo "")
if [ -n "$result" ] && ! echo "$result" | grep -q "0x0000000000000000000000000000000000000000$"; then
echo "$chain configured"
else
echo "$chain not configured"
fi
done