Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
- Config, docs, scripts, and backup manifests - Submodule refs unchanged (m = modified content in submodules) Made-with: Cursor
34 lines
1.6 KiB
Bash
Executable File
34 lines
1.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Deploy TransactionMirror to Chain 138 using next nonce (skip stuck tx).
|
|
# Usage: ./scripts/deployment/deploy-transaction-mirror-chain138-nonce-fix.sh [NONCE]
|
|
# Default NONCE = 13370 (when current is 13369 stuck). Requires: .env with PRIVATE_KEY; RPC reachable (Public 2201 OK).
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
SMOM="${PROJECT_ROOT}/smom-dbis-138"
|
|
NONCE="${1:-13370}"
|
|
|
|
[[ -f "${SMOM}/.env" ]] && set -a && source "${SMOM}/.env" 2>/dev/null && set +a
|
|
RPC="${RPC_URL_138:-${RPC_URL_138_PUBLIC:-http://192.168.11.221:8545}}"
|
|
[[ -z "${PRIVATE_KEY:-}" ]] && echo "PRIVATE_KEY not set." >&2 && exit 1
|
|
[[ "${PRIVATE_KEY#0x}" == "$PRIVATE_KEY" ]] && export PRIVATE_KEY="0x$PRIVATE_KEY"
|
|
ADMIN="${MIRROR_ADMIN:-$(cast wallet address --private-key "$PRIVATE_KEY" 2>/dev/null)}"
|
|
|
|
echo "Deploying TransactionMirror (nonce=$NONCE) to $RPC"
|
|
cd "$SMOM"
|
|
out=$(forge create contracts/mirror/TransactionMirror.sol:TransactionMirror \
|
|
--constructor-args "$ADMIN" \
|
|
--rpc-url "$RPC" \
|
|
--private-key "$PRIVATE_KEY" \
|
|
--gas-price 1000000000 \
|
|
--nonce "$NONCE" 2>&1) || { echo "$out"; exit 1; }
|
|
echo "$out"
|
|
addr=$(echo "$out" | grep -oE 'Deployed to: (0x[a-fA-F0-9]{40})' | sed 's/Deployed to: //')
|
|
[[ -z "$addr" ]] && addr=$(echo "$out" | grep -oE '0x[a-fA-F0-9]{40}' | head -1)
|
|
[[ -z "$addr" ]] && { echo "Could not parse deployed address"; exit 1; }
|
|
echo ""
|
|
echo "TransactionMirror deployed at: $addr"
|
|
echo "Update scripts/verify/check-contracts-on-chain-138.sh and docs to use $addr instead of 0xe363a69273C3471ECaf313f8Ca45bc7C538c5e78"
|