deployment(ccip): Step 0 allowlist Wemix/Gnosis/Cronos/Celo on Chain 138 CCIPRouter
Without supportedChains(selector)=true, bridge.calculateFee reverts CCIPRouter: chain not supported. Registers selectors via addSupportedChain before addDestination. Made-with: Cursor
This commit is contained in:
@@ -71,6 +71,10 @@ if ! require_private_key_env; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Custom CCIPRouter on Chain 138 (smom-dbis-138/contracts/ccip/CCIPRouter.sol) maintains an allowlist.
|
||||
# If a selector is missing, bridge.calculateFee / ccipSend revert with CCIPRouter: chain not supported.
|
||||
CCIP_ROUTER="${CCIP_ROUTER:-}"
|
||||
|
||||
run_or_echo() {
|
||||
if [[ "$DRY_RUN" = "1" ]]; then
|
||||
echo " [DRY RUN] $*"
|
||||
@@ -87,6 +91,21 @@ run_or_echo() {
|
||||
fi
|
||||
}
|
||||
|
||||
ensure_router_supports_selector() {
|
||||
local label="$1"
|
||||
local selector="$2"
|
||||
[[ -z "$CCIP_ROUTER" || -z "$selector" ]] && return 0
|
||||
local rout="${CCIP_ROUTER,,}"
|
||||
local supported
|
||||
supported=$(cast call "$rout" "supportedChains(uint64)(bool)" "$selector" --rpc-url "$CHAIN138_RPC" 2>/dev/null || echo "false")
|
||||
if [[ "$supported" != "true" ]]; then
|
||||
echo " CCIP router: enabling chain selector for $label ($selector)..."
|
||||
run_or_echo "cast send $rout \"addSupportedChain(uint64)\" $selector --rpc-url $CHAIN138_RPC --private-key \$PRIVATE_KEY --legacy --gas-limit 250000 --gas-price 2000000000"
|
||||
else
|
||||
echo " CCIP router: $label selector already supported ($selector)"
|
||||
fi
|
||||
}
|
||||
|
||||
configure_chain_138_destination() {
|
||||
local label="$1"
|
||||
local selector="$2"
|
||||
@@ -127,6 +146,18 @@ configure_remote_chain_destination() {
|
||||
fi
|
||||
}
|
||||
|
||||
# ---- Step 0: CCIPRouter allowlist (must precede bridge fee quotes / sends) ----
|
||||
echo ""
|
||||
echo "Step 0: CCIP router on Chain 138 → allowlist selectors (Gnosis, Cronos, Celo, Wemix)"
|
||||
if [[ -n "$CCIP_ROUTER" ]]; then
|
||||
ensure_router_supports_selector "Gnosis" "$GNOSIS_SELECTOR"
|
||||
ensure_router_supports_selector "Cronos" "$CRONOS_SELECTOR"
|
||||
ensure_router_supports_selector "Celo" "$CELO_SELECTOR"
|
||||
ensure_router_supports_selector "Wemix" "$WEMIX_SELECTOR"
|
||||
else
|
||||
echo " Skip (CCIP_ROUTER not set in .env)"
|
||||
fi
|
||||
|
||||
# ---- Step A: On Chain 138, add Gnosis/Cronos/Celo/Wemix as destinations ----
|
||||
echo ""
|
||||
echo "Step A: Chain 138 bridges → add Gnosis, Cronos, Celo, Wemix as destinations"
|
||||
|
||||
Reference in New Issue
Block a user