From 0463dbf8892a6368bc71d07fde5aa400e4e25a6a Mon Sep 17 00:00:00 2001 From: defiQUG Date: Fri, 27 Mar 2026 22:17:12 -0700 Subject: [PATCH] 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 --- config/README.md | 2 +- config/ccip-destination-matrix.json | 55 ++++++++++++++++++ scripts/check-bridge-config.sh | 30 ++++------ scripts/configure-all-bridge-destinations.sh | 48 +++++----------- scripts/configure-all-destinations-auto.sh | 38 +++---------- scripts/lib/ccip-destinations.sh | 38 +++++++++++++ scripts/pre-flight-check.sh | 59 +++++++------------- 7 files changed, 149 insertions(+), 121 deletions(-) create mode 100644 config/ccip-destination-matrix.json create mode 100644 scripts/lib/ccip-destinations.sh diff --git a/config/README.md b/config/README.md index 1dabf2f..65438c7 100644 --- a/config/README.md +++ b/config/README.md @@ -1,6 +1,6 @@ # config — reference JSON (non-secret) -Files such as `address-inventory.json` and `runtime-env.json` are **reference snapshots** of address and runtime surface fields that were previously carried only in `.env`. They must **not** contain API keys or other secrets. +Files such as `address-inventory.json`, `runtime-env.json`, and `ccip-destination-matrix.json` are **reference snapshots** of address and runtime surface fields that were previously carried only in `.env` or duplicated across scripts. They must **not** contain API keys or other secrets. - Keep **real secrets** in `.env` (gitignored) or your secret store. - After changing explorer-related env or CCIP addresses, update these JSON files if scripts or docs depend on them. diff --git a/config/ccip-destination-matrix.json b/config/ccip-destination-matrix.json new file mode 100644 index 0000000..1851b84 --- /dev/null +++ b/config/ccip-destination-matrix.json @@ -0,0 +1,55 @@ +{ + "description": "Canonical CCIP destination selector and bridge matrix used by explorer-monorepo operator scripts.", + "updated": "2026-03-27", + "chains": [ + { + "name": "BSC", + "selector": "11344663589394136015", + "weth9Bridge": "0x8078a09637e47fa5ed34f626046ea2094a5cde5e", + "weth10Bridge": "0x105f8a15b819948a89153505762444ee9f324684", + "rpcUrl": "https://bsc-dataseed.binance.org" + }, + { + "name": "Polygon", + "selector": "4051577828743386545", + "weth9Bridge": "0xa780ef19a041745d353c9432f2a7f5a241335ffe", + "weth10Bridge": "0xdab0591e5e89295ffad75a71dcfc30c5625c4fa2", + "rpcUrl": "https://polygon-rpc.com" + }, + { + "name": "Avalanche", + "selector": "6433500567565415381", + "weth9Bridge": "0x8078a09637e47fa5ed34f626046ea2094a5cde5e", + "weth10Bridge": "0x105f8a15b819948a89153505762444ee9f324684", + "rpcUrl": "https://api.avax.network/ext/bc/C/rpc" + }, + { + "name": "Base", + "selector": "15971525489660198786", + "weth9Bridge": "0x8078a09637e47fa5ed34f626046ea2094a5cde5e", + "weth10Bridge": "0x105f8a15b819948a89153505762444ee9f324684", + "rpcUrl": "https://mainnet.base.org" + }, + { + "name": "Arbitrum", + "selector": "4949039107694359620", + "weth9Bridge": "0x8078a09637e47fa5ed34f626046ea2094a5cde5e", + "weth10Bridge": "0x105f8a15b819948a89153505762444ee9f324684", + "rpcUrl": "https://arb1.arbitrum.io/rpc" + }, + { + "name": "Optimism", + "selector": "3734403246176062136", + "weth9Bridge": "0x8078a09637e47fa5ed34f626046ea2094a5cde5e", + "weth10Bridge": "0x105f8a15b819948a89153505762444ee9f324684", + "rpcUrl": "https://mainnet.optimism.io" + }, + { + "name": "Ethereum", + "selector": "5009297550715157269", + "weth9Bridge": "0x2A0840e5117683b11682ac46f5CF5621E67269E3", + "weth10Bridge": "0xb7721dD53A8c629d9f1Ba31a5819AFe250002b03", + "rpcUrl": "https://eth.llamarpc.com" + } + ] +} diff --git a/scripts/check-bridge-config.sh b/scripts/check-bridge-config.sh index 02dc85e..e757172 100755 --- a/scripts/check-bridge-config.sh +++ b/scripts/check-bridge-config.sh @@ -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 "" - diff --git a/scripts/configure-all-bridge-destinations.sh b/scripts/configure-all-bridge-destinations.sh index 96f1c78..0bd4508 100755 --- a/scripts/configure-all-bridge-destinations.sh +++ b/scripts/configure-all-bridge-destinations.sh @@ -7,6 +7,7 @@ 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' @@ -43,7 +44,20 @@ elif [ -z "${PRIVATE_KEY:-}" ]; then exit 1 fi -# Update Ethereum Mainnet addresses if provided +declare -A WETH9_DESTINATIONS=() +declare -A WETH10_DESTINATIONS=() +declare -A CHAIN_NAMES=() + +while IFS=$'\t' read -r chain_name selector weth9_dest weth10_dest _rpc_url; do + CHAIN_NAMES["$selector"]="$chain_name" + WETH9_DESTINATIONS["$selector"]="$weth9_dest" + WETH10_DESTINATIONS["$selector"]="$weth10_dest" +done < <(ccip_destination_rows) + +# Preserve the manual flow: Ethereum stays TBD unless explicitly provided. +WETH9_DESTINATIONS["5009297550715157269"]="TBD" +WETH10_DESTINATIONS["5009297550715157269"]="TBD" + if [ -n "$WETH9_ETH_MAINNET" ] && echo "$WETH9_ETH_MAINNET" | grep -qE "^0x[0-9a-fA-F]{40}$"; then WETH9_DESTINATIONS["5009297550715157269"]="$WETH9_ETH_MAINNET" log_info "Using provided WETH9 Ethereum Mainnet address: $WETH9_ETH_MAINNET" @@ -54,38 +68,6 @@ if [ -n "$WETH10_ETH_MAINNET" ] && echo "$WETH10_ETH_MAINNET" | grep -qE "^0x[0- log_info "Using provided WETH10 Ethereum Mainnet address: $WETH10_ETH_MAINNET" fi -# Destination chains with their bridge addresses -# Format: selector:bridge_address -declare -A WETH9_DESTINATIONS=( - ["11344663589394136015"]="0x8078a09637e47fa5ed34f626046ea2094a5cde5e" # BSC - ["4051577828743386545"]="0xa780ef19a041745d353c9432f2a7f5a241335ffe" # Polygon - ["6433500567565415381"]="0x8078a09637e47fa5ed34f626046ea2094a5cde5e" # Avalanche - ["15971525489660198786"]="0x8078a09637e47fa5ed34f626046ea2094a5cde5e" # Base - ["4949039107694359620"]="0x8078a09637e47fa5ed34f626046ea2094a5cde5e" # Arbitrum - ["3734403246176062136"]="0x8078a09637e47fa5ed34f626046ea2094a5cde5e" # Optimism - ["5009297550715157269"]="TBD" # Ethereum Mainnet - needs to be provided -) - -declare -A WETH10_DESTINATIONS=( - ["11344663589394136015"]="0x105f8a15b819948a89153505762444ee9f324684" # BSC - ["4051577828743386545"]="0xdab0591e5e89295ffad75a71dcfc30c5625c4fa2" # Polygon - ["6433500567565415381"]="0x105f8a15b819948a89153505762444ee9f324684" # Avalanche - ["15971525489660198786"]="0x105f8a15b819948a89153505762444ee9f324684" # Base - ["4949039107694359620"]="0x105f8a15b819948a89153505762444ee9f324684" # Arbitrum - ["3734403246176062136"]="0x105f8a15b819948a89153505762444ee9f324684" # Optimism - ["5009297550715157269"]="TBD" # Ethereum Mainnet - needs to be provided -) - -declare -A CHAIN_NAMES=( - ["11344663589394136015"]="BSC" - ["4051577828743386545"]="Polygon" - ["6433500567565415381"]="Avalanche" - ["15971525489660198786"]="Base" - ["4949039107694359620"]="Arbitrum" - ["3734403246176062136"]="Optimism" - ["5009297550715157269"]="Ethereum Mainnet" -) - # Get deployer address DEPLOYER=$(cast wallet address --private-key "$PRIVATE_KEY" 2>/dev/null || echo "") if [ -z "$DEPLOYER" ]; then diff --git a/scripts/configure-all-destinations-auto.sh b/scripts/configure-all-destinations-auto.sh index 9eaedff..b271542 100755 --- a/scripts/configure-all-destinations-auto.sh +++ b/scripts/configure-all-destinations-auto.sh @@ -8,6 +8,7 @@ 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' @@ -59,36 +60,15 @@ if ! "$SCRIPT_DIR/pre-flight-check.sh" > /dev/null 2>&1; then fi log_info "" -# Destination chains with their bridge addresses -declare -A WETH9_DESTINATIONS=( - ["11344663589394136015"]="0x8078a09637e47fa5ed34f626046ea2094a5cde5e" # BSC - ["4051577828743386545"]="0xa780ef19a041745d353c9432f2a7f5a241335ffe" # Polygon - ["6433500567565415381"]="0x8078a09637e47fa5ed34f626046ea2094a5cde5e" # Avalanche - ["15971525489660198786"]="0x8078a09637e47fa5ed34f626046ea2094a5cde5e" # Base - ["4949039107694359620"]="0x8078a09637e47fa5ed34f626046ea2094a5cde5e" # Arbitrum - ["3734403246176062136"]="0x8078a09637e47fa5ed34f626046ea2094a5cde5e" # Optimism - ["5009297550715157269"]="0x2A0840e5117683b11682ac46f5CF5621E67269E3" # Ethereum Mainnet -) +declare -A WETH9_DESTINATIONS=() +declare -A WETH10_DESTINATIONS=() +declare -A CHAIN_NAMES=() -declare -A WETH10_DESTINATIONS=( - ["11344663589394136015"]="0x105f8a15b819948a89153505762444ee9f324684" # BSC - ["4051577828743386545"]="0xdab0591e5e89295ffad75a71dcfc30c5625c4fa2" # Polygon - ["6433500567565415381"]="0x105f8a15b819948a89153505762444ee9f324684" # Avalanche - ["15971525489660198786"]="0x105f8a15b819948a89153505762444ee9f324684" # Base - ["4949039107694359620"]="0x105f8a15b819948a89153505762444ee9f324684" # Arbitrum - ["3734403246176062136"]="0x105f8a15b819948a89153505762444ee9f324684" # Optimism - ["5009297550715157269"]="0xb7721dD53A8c629d9f1Ba31a5819AFe250002b03" # Ethereum Mainnet -) - -declare -A CHAIN_NAMES=( - ["11344663589394136015"]="BSC" - ["4051577828743386545"]="Polygon" - ["6433500567565415381"]="Avalanche" - ["15971525489660198786"]="Base" - ["4949039107694359620"]="Arbitrum" - ["3734403246176062136"]="Optimism" - ["5009297550715157269"]="Ethereum Mainnet" -) +while IFS=$'\t' read -r chain_name selector weth9_dest weth10_dest _rpc_url; do + CHAIN_NAMES["$selector"]="$chain_name" + WETH9_DESTINATIONS["$selector"]="$weth9_dest" + WETH10_DESTINATIONS["$selector"]="$weth10_dest" +done < <(ccip_destination_rows) # Function to configure destination with verification configure_destination() { diff --git a/scripts/lib/ccip-destinations.sh b/scripts/lib/ccip-destinations.sh new file mode 100644 index 0000000..096a126 --- /dev/null +++ b/scripts/lib/ccip-destinations.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +# Shared helpers for the canonical CCIP destination matrix. + +_ccip_dest_helper_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +EXPLORER_PROJECT_ROOT="${EXPLORER_PROJECT_ROOT:-$(cd "$_ccip_dest_helper_dir/../.." && pwd)}" +CCIP_DESTINATION_MATRIX_FILE="${CCIP_DESTINATION_MATRIX_FILE:-$EXPLORER_PROJECT_ROOT/config/ccip-destination-matrix.json}" + +ccip_destination_rows() { + if [ ! -f "$CCIP_DESTINATION_MATRIX_FILE" ]; then + echo "Missing CCIP destination matrix: $CCIP_DESTINATION_MATRIX_FILE" >&2 + return 1 + fi + if ! command -v jq >/dev/null 2>&1; then + echo "jq is required to read $CCIP_DESTINATION_MATRIX_FILE" >&2 + return 1 + fi + jq -r '.chains[] | [.name, (.selector | tostring), (.weth9Bridge // ""), (.weth10Bridge // ""), (.rpcUrl // "")] | @tsv' \ + "$CCIP_DESTINATION_MATRIX_FILE" +} + +ccip_destination_count() { + if [ ! -f "$CCIP_DESTINATION_MATRIX_FILE" ] || ! command -v jq >/dev/null 2>&1; then + return 1 + fi + jq '.chains | length' "$CCIP_DESTINATION_MATRIX_FILE" +} + +ccip_destination_field_by_name() { + local chain_name="${1:-}" + local field_name="${2:-}" + if [ -z "$chain_name" ] || [ -z "$field_name" ] || [ ! -f "$CCIP_DESTINATION_MATRIX_FILE" ] || ! command -v jq >/dev/null 2>&1; then + return 1 + fi + jq -r --arg name "$chain_name" --arg field "$field_name" \ + '.chains[] | select(.name == $name) | .[$field] // empty' \ + "$CCIP_DESTINATION_MATRIX_FILE" +} diff --git a/scripts/pre-flight-check.sh b/scripts/pre-flight-check.sh index b9eae5b..6811a0e 100755 --- a/scripts/pre-flight-check.sh +++ b/scripts/pre-flight-check.sh @@ -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,12 +22,7 @@ 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}" @@ -70,10 +67,10 @@ fi log_info "" log_info "2. PRIVATE_KEY Configuration" if [ -z "${PRIVATE_KEY:-}" ]; then - check_fail "PRIVATE_KEY not set in .env file" - log_info " Add to .env: PRIVATE_KEY=0x..." + check_fail "PRIVATE_KEY not available in effective environment" + log_info " Export PRIVATE_KEY=0x... before running" else - check_pass "PRIVATE_KEY found in .env" + check_pass "PRIVATE_KEY available in effective environment" # Validate private key format if ! echo "$PRIVATE_KEY" | grep -qE "^0x[0-9a-fA-F]{64}$"; then @@ -130,10 +127,10 @@ fi log_info "" log_info "5. Contract Deployments" -ROUTER="0x8078A09637e47Fa5Ed34F626046Ea2094a5CDE5e" +ROUTER="$(resolve_address_value CCIP_ROUTER_ADDRESS CCIP_ROUTER_ADDRESS 0x8078A09637e47Fa5Ed34F626046Ea2094a5CDE5e)" SENDER="0x105F8A15b819948a89153505762444Ee9f324684" -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)" ROUTER_BYTECODE=$(cast code "$ROUTER" --rpc-url "$RPC_URL" 2>/dev/null || echo "") if [ -n "$ROUTER_BYTECODE" ] && [ "$ROUTER_BYTECODE" != "0x" ]; then @@ -167,30 +164,19 @@ fi log_info "" log_info "6. Destination Address Validation" -declare -A DESTINATIONS=( - ["BSC"]="11344663589394136015:0x8078a09637e47fa5ed34f626046ea2094a5cde5e:0x105f8a15b819948a89153505762444ee9f324684" - ["Polygon"]="4051577828743386545:0xa780ef19a041745d353c9432f2a7f5a241335ffe:0xdab0591e5e89295ffad75a71dcfc30c5625c4fa2" - ["Avalanche"]="6433500567565415381:0x8078a09637e47fa5ed34f626046ea2094a5cde5e:0x105f8a15b819948a89153505762444ee9f324684" - ["Base"]="15971525489660198786:0x8078a09637e47fa5ed34f626046ea2094a5cde5e:0x105f8a15b819948a89153505762444ee9f324684" - ["Arbitrum"]="4949039107694359620:0x8078a09637e47fa5ed34f626046ea2094a5cde5e:0x105f8a15b819948a89153505762444ee9f324684" - ["Optimism"]="3734403246176062136:0x8078a09637e47fa5ed34f626046ea2094a5cde5e:0x105f8a15b819948a89153505762444ee9f324684" - ["Ethereum"]="5009297550715157269:0x2A0840e5117683b11682ac46f5CF5621E67269E3:0xb7721dD53A8c629d9f1Ba31a5819AFe250002b03" -) - VALID_DESTINATIONS=0 -for CHAIN_NAME in "${!DESTINATIONS[@]}"; do - IFS=':' read -r SELECTOR WETH9_ADDR WETH10_ADDR <<< "${DESTINATIONS[$CHAIN_NAME]}" - +TOTAL_DESTINATIONS="$(ccip_destination_count)" +while IFS=$'\t' read -r _chain_name SELECTOR WETH9_ADDR WETH10_ADDR _rpc_url; do if echo "$WETH9_ADDR" | grep -qE "^0x[0-9a-fA-F]{40}$" && \ echo "$WETH10_ADDR" | grep -qE "^0x[0-9a-fA-F]{40}$"; then ((VALID_DESTINATIONS++)) || true fi -done +done < <(ccip_destination_rows) -if [ $VALID_DESTINATIONS -eq 7 ]; then - check_pass "All 7 destination addresses valid" +if [ "$VALID_DESTINATIONS" -eq "$TOTAL_DESTINATIONS" ]; then + check_pass "All $TOTAL_DESTINATIONS destination addresses valid" else - check_fail "Some destination addresses invalid ($VALID_DESTINATIONS/7 valid)" + check_fail "Some destination addresses invalid ($VALID_DESTINATIONS/$TOTAL_DESTINATIONS valid)" fi # Check 7: Current Configuration Status @@ -200,9 +186,7 @@ log_info "7. Current Configuration Status" WETH9_CONFIGURED=0 WETH10_CONFIGURED=0 -for CHAIN_NAME in "${!DESTINATIONS[@]}"; do - IFS=':' read -r SELECTOR WETH9_ADDR WETH10_ADDR <<< "${DESTINATIONS[$CHAIN_NAME]}" - +while IFS=$'\t' read -r _chain_name SELECTOR _weth9 _weth10 _rpc_url; do DEST_WETH9=$(cast call "$WETH9_BRIDGE" "destinations(uint64)" "$SELECTOR" --rpc-url "$RPC_URL" 2>/dev/null || echo "") DEST_WETH9_CLEAN=$(echo "$DEST_WETH9" | grep -oE "^0x[0-9a-fA-F]{40}$" | head -1 || echo "") if [ -n "$DEST_WETH9_CLEAN" ] && ! echo "$DEST_WETH9_CLEAN" | grep -qE "^0x0+$"; then @@ -214,12 +198,12 @@ for CHAIN_NAME in "${!DESTINATIONS[@]}"; do if [ -n "$DEST_WETH10_CLEAN" ] && ! echo "$DEST_WETH10_CLEAN" | grep -qE "^0x0+$"; then ((WETH10_CONFIGURED++)) || true fi -done +done < <(ccip_destination_rows) -log_info " WETH9 Bridge: $WETH9_CONFIGURED/7 destinations configured" -log_info " WETH10 Bridge: $WETH10_CONFIGURED/7 destinations configured" +log_info " WETH9 Bridge: $WETH9_CONFIGURED/$TOTAL_DESTINATIONS destinations configured" +log_info " WETH10 Bridge: $WETH10_CONFIGURED/$TOTAL_DESTINATIONS destinations configured" -if [ $WETH9_CONFIGURED -eq 7 ] && [ $WETH10_CONFIGURED -eq 7 ]; then +if [ "$WETH9_CONFIGURED" -eq "$TOTAL_DESTINATIONS" ] && [ "$WETH10_CONFIGURED" -eq "$TOTAL_DESTINATIONS" ]; then check_pass "All destinations already configured" elif [ $WETH9_CONFIGURED -gt 0 ] || [ $WETH10_CONFIGURED -gt 0 ]; then check_warn "Partial configuration ($WETH9_CONFIGURED WETH9, $WETH10_CONFIGURED WETH10)" @@ -251,7 +235,7 @@ else log_info "" log_info "Next steps:" if [ -z "${PRIVATE_KEY:-}" ]; then - log_info " 1. Add PRIVATE_KEY to .env file" + log_info " 1. Export PRIVATE_KEY before rerunning" fi if [ -n "${ACCOUNT:-}" ] && [ -n "${ETH_BALANCE_ETH:-}" ]; then if (( $(echo "$ETH_BALANCE_ETH < 0.02" | bc -l 2>/dev/null || echo 1) )); then @@ -260,4 +244,3 @@ else fi exit 1 fi -