feat(scripts): CCIP destination matrix + ccip-destinations helper

- Add config/ccip-destination-matrix.json (selectors, bridges, public RPCs)
- Drive configure-all-*-destinations scripts from matrix via jq
- Extend config/README; wire check-bridge-config and pre-flight-check

Made-with: Cursor
This commit is contained in:
defiQUG
2026-03-27 22:17:12 -07:00
parent d0f6044b9b
commit 0463dbf889
7 changed files with 149 additions and 121 deletions

View File

@@ -7,6 +7,8 @@ set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
source "$PROJECT_ROOT/scripts/lib/address-inventory.sh"
source "$PROJECT_ROOT/scripts/lib/ccip-destinations.sh"
# Colors
RED='\033[0;31m'
@@ -20,28 +22,17 @@ log_success() { echo -e "${GREEN}[✓]${NC} $1"; }
log_warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
log_error() { echo -e "${RED}[ERROR]${NC} $1"; }
# Load environment variables if .env exists
if [ -f "$PROJECT_ROOT/.env" ]; then
source "$PROJECT_ROOT/.env"
elif [ -f "$PROJECT_ROOT/../.env" ]; then
source "$PROJECT_ROOT/../.env"
fi
load_explorer_runtime_env
# Configuration
RPC_URL="${RPC_URL_138:-http://192.168.11.250:8545}"
WETH9_BRIDGE="0x971cD9D156f193df8051E48043C476e53ECd4693"
WETH10_BRIDGE="0xe0E93247376aa097dB308B92e6Ba36bA015535D0"
WETH9_BRIDGE="$(resolve_address_value CCIPWETH9_BRIDGE CCIPWETH9_BRIDGE 0x971cD9D156f193df8051E48043C476e53ECd4693)"
WETH10_BRIDGE="$(resolve_address_value CCIPWETH10_BRIDGE CCIPWETH10_BRIDGE 0xe0E93247376aa097dB308B92e6Ba36bA015535D0)"
# All destination chains
declare -A CHAIN_SELECTORS=(
["BSC"]="11344663589394136015"
["Polygon"]="4051577828743386545"
["Avalanche"]="6433500567565415381"
["Base"]="15971525489660198786"
["Arbitrum"]="4949039107694359620"
["Optimism"]="3734403246176062136"
["Ethereum"]="5009297550715157269"
)
declare -A CHAIN_SELECTORS=()
while IFS=$'\t' read -r chain_name selector _weth9 _weth10 _rpc_url; do
CHAIN_SELECTORS["$chain_name"]="$selector"
done < <(ccip_destination_rows)
log_info "========================================="
log_info "Bridge Configuration Check"
@@ -136,7 +127,7 @@ if [ $MISSING_COUNT -eq 0 ]; then
log_success "✓ WETH9 Bridge: All destinations configured"
else
log_warn "⚠ WETH9 Bridge: $MISSING_COUNT destination(s) missing"
if [ $MISSING_COUNT -eq 1 ] && echo "${CHAIN_SELECTORS[@]}" | grep -q "5009297550715157269"; then
if [ $MISSING_COUNT -eq 1 ] && [ -n "${CHAIN_SELECTORS[Ethereum]:-}" ]; then
log_info " Missing: Ethereum Mainnet"
log_info " Fix: ./scripts/fix-bridge-errors.sh [private_key] [ethereum_mainnet_bridge_address]"
fi
@@ -149,4 +140,3 @@ else
fi
log_info ""