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>
44 lines
1.9 KiB
Bash
Executable File
44 lines
1.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Fund the mainnet CCIPRelayBridge with WETH from the deployer wallet.
|
|
# Usage: ./scripts/bridge/fund-mainnet-relay-bridge.sh [amount_wei]
|
|
# If amount_wei is omitted, transfers the deployer's full WETH balance.
|
|
# Env: PRIVATE_KEY, ETHEREUM_MAINNET_RPC or RPC_URL_MAINNET (use Infura/Alchemy if llamarpc rate-limits)
|
|
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
|
|
|
|
DEPLOYER="${DEPLOYER_ADDRESS:-0x4A666F96fC8764181194447A7dFdb7d471b301C8}"
|
|
WETH="0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
|
|
BRIDGE="0xF9A32F37099c582D28b4dE7Fca6eaC1e5259f939"
|
|
# Prefer RPC_URL_MAINNET so override works (e.g. RPC_URL_MAINNET=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"; exit 1; }
|
|
command -v cast &>/dev/null || { echo "cast not found (install Foundry)"; exit 1; }
|
|
|
|
BALANCE=$(cast call $WETH "balanceOf(address)(uint256)" $DEPLOYER --rpc-url "$RPC" 2>/dev/null || echo "0")
|
|
echo "Deployer WETH balance (mainnet): $BALANCE wei"
|
|
echo "Bridge WETH balance (mainnet): $(cast call $WETH "balanceOf(address)(uint256)" $BRIDGE --rpc-url "$RPC" 2>/dev/null || echo "0") wei"
|
|
|
|
if [[ "${1:-}" = "" ]]; then
|
|
AMT="$BALANCE"
|
|
echo "Transferring full balance: $AMT wei"
|
|
else
|
|
AMT="$1"
|
|
echo "Transferring: $AMT wei"
|
|
fi
|
|
|
|
if [[ -z "$AMT" ]] || [[ "$AMT" = "0" ]]; then
|
|
echo "Nothing to transfer."
|
|
exit 0
|
|
fi
|
|
|
|
cast send $WETH "transfer(address,uint256)" $BRIDGE "$AMT" \
|
|
--rpc-url "$RPC" \
|
|
--private-key "$PRIVATE_KEY" \
|
|
--legacy
|
|
|
|
echo "Done. Bridge WETH balance: $(cast call $WETH "balanceOf(address)(uint256)" $BRIDGE --rpc-url "$RPC") wei"
|