Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
- ADD_CHAIN138_TO_LEDGER_LIVE: Ledger form done; public code review repo bis-innovations/LedgerLive; init/push commands - CONTRACT_DEPLOYMENT_RUNBOOK: Chain 138 gas price 1 gwei, 36-addr check, TransactionMirror workaround - CONTRACT_*: AddressMapper, MirrorManager deployed 2026-02-12; 36-address on-chain check - NEXT_STEPS_FOR_YOU: Ledger done; steps completable now (no LAN); run-completable-tasks-from-anywhere - MASTER_INDEX, OPERATOR_OPTIONAL, SMART_CONTRACTS_INVENTORY_SIMPLE: updates - LEDGER_BLOCKCHAIN_INTEGRATION_COMPLETE: bis-innovations/LedgerLive reference Co-authored-by: Cursor <cursoragent@cursor.com>
48 lines
2.1 KiB
Bash
48 lines
2.1 KiB
Bash
#!/usr/bin/env bash
|
|
# Grant RELAYER_ROLE on mainnet CCIPRelayRouter to the relay service address.
|
|
# Run once with the router's admin key (deployer). Required when relay tx reverts with "transaction execution reverted".
|
|
#
|
|
# Usage: ./scripts/bridge/grant-relayer-role-mainnet.sh [relayer_address]
|
|
# relayer_address defaults to 0x4A666F96fC8764181194447A7dFdb7d471b301C8 (from relay .env RELAYER_ADDRESS)
|
|
# Env: PRIVATE_KEY (admin of router), ETHEREUM_MAINNET_RPC or RPC_URL_MAINNET
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
[[ -f "${PROJECT_ROOT}/smom-dbis-138/.env" ]] && source "${PROJECT_ROOT}/smom-dbis-138/.env" 2>/dev/null || true
|
|
[[ -f "${PROJECT_ROOT}/.env" ]] && source "${PROJECT_ROOT}/.env" 2>/dev/null || true
|
|
|
|
RELAY_ROUTER="${CCIP_RELAY_ROUTER_MAINNET:-0xAd9A228CcEB4cbB612cD165FFB72fE090ff10Afb}"
|
|
RELAYER="${1:-0x4A666F96fC8764181194447A7dFdb7d471b301C8}"
|
|
# Prefer RPC_URL_MAINNET so command-line override works (e.g. ETHEREUM_MAINNET_RPC=https://ethereum.publicnode.com if Infura requires secret)
|
|
RPC="${RPC_URL_MAINNET:-${ETHEREUM_MAINNET_RPC:-https://ethereum.publicnode.com}}"
|
|
|
|
[[ -n "${PRIVATE_KEY:-}" ]] || { echo "PRIVATE_KEY required (must be admin of CCIPRelayRouter)"; exit 1; }
|
|
command -v cast &>/dev/null || { echo "cast not found (install Foundry)"; exit 1; }
|
|
|
|
echo "CCIPRelayRouter (mainnet): $RELAY_ROUTER"
|
|
echo "Granting RELAYER_ROLE to: $RELAYER"
|
|
echo "RPC: $RPC"
|
|
echo ""
|
|
|
|
# Optional: check if already has role (keccak256("RELAYER_ROLE"))
|
|
ROLE_HASH=$(cast keccak "RELAYER_ROLE" 2>/dev/null || true)
|
|
if [[ -n "$ROLE_HASH" ]]; then
|
|
HAS_ROLE=$(cast call "$RELAY_ROUTER" "hasRole(bytes32,address)(bool)" "$ROLE_HASH" "$RELAYER" --rpc-url "$RPC" 2>/dev/null || echo "false")
|
|
else
|
|
HAS_ROLE="false"
|
|
fi
|
|
|
|
if [[ "${HAS_ROLE:-false}" = "true" ]]; then
|
|
echo "Relayer already has RELAYER_ROLE. No action needed."
|
|
exit 0
|
|
fi
|
|
|
|
echo "Sending grantRelayerRole(relayer)..."
|
|
cast send "$RELAY_ROUTER" "grantRelayerRole(address)" "$RELAYER" \
|
|
--rpc-url "$RPC" \
|
|
--private-key "$PRIVATE_KEY" \
|
|
--legacy
|
|
|
|
echo "Done. Restart the relay service so it can relay messages."
|