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>
184 lines
5.7 KiB
Bash
Executable File
184 lines
5.7 KiB
Bash
Executable File
#!/bin/bash
|
|
# Deploy contracts using next nonce to skip stuck transactions
|
|
# This script gets the next nonce and deploys with explicit gas prices
|
|
|
|
set -euo pipefail
|
|
|
|
# Load IP configuration
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
source "${PROJECT_ROOT}/config/ip-addresses.conf" 2>/dev/null || true
|
|
|
|
RPC_URL="${RPC_URL:-http://${RPC_CORE_1}:8545}"
|
|
DEPLOYER="${DEPLOYER:-0x4A666F96fC8764181194447A7dFdb7d471b301C8}"
|
|
GAS_PRICE="${GAS_PRICE:-10000000000}" # 10 gwei default
|
|
SCRIPT_DIR="${SCRIPT_DIR:-/home/intlc/projects/proxmox/smom-dbis-138}"
|
|
|
|
# Colors
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
BLUE='\033[0;34m'
|
|
CYAN='\033[0;36m'
|
|
NC='\033[0m'
|
|
|
|
log_info() { echo -e "${BLUE}[INFO]${NC} $1"; }
|
|
log_success() { echo -e "${GREEN}[✓]${NC} $1"; }
|
|
log_warn() { echo -e "${YELLOW}[⚠]${NC} $1"; }
|
|
log_error() { echo -e "${RED}[✗]${NC} $1"; }
|
|
log_section() { echo -e "\n${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"; echo -e "${CYAN}$1${NC}"; echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}\n"; }
|
|
|
|
echo "=== Deploy with Next Nonce ==="
|
|
echo ""
|
|
|
|
# Check RPC connectivity
|
|
if ! timeout 5 cast chain-id --rpc-url "$RPC_URL" >/dev/null 2>&1; then
|
|
log_error "RPC not accessible"
|
|
exit 1
|
|
fi
|
|
|
|
# Get next nonce
|
|
log_section "Getting Next Nonce"
|
|
PENDING_HEX=$(cast rpc eth_getTransactionCount "$DEPLOYER" pending --rpc-url "$RPC_URL" 2>/dev/null | tr -d '"')
|
|
NEXT_NONCE=$(cast --to-dec "$PENDING_HEX" 2>/dev/null || echo "0")
|
|
|
|
log_success "Next nonce to use: $NEXT_NONCE"
|
|
log_info "Gas price: $GAS_PRICE ($(echo "scale=2; $GAS_PRICE / 1000000000" | bc 2>/dev/null || echo "N/A") gwei)"
|
|
echo ""
|
|
|
|
# Check if bridges are already deployed
|
|
log_section "Checking Existing Deployments"
|
|
BRIDGE9="0x89dd12025bfCD38A168455A44B400e913ED33BE2"
|
|
BRIDGE10="0xe0E93247376aa097dB308B92e6Ba36bA015535D0"
|
|
|
|
BRIDGE9_CODE=$(cast code "$BRIDGE9" --rpc-url "$RPC_URL" 2>/dev/null | head -c 20 || echo "")
|
|
BRIDGE10_CODE=$(cast code "$BRIDGE10" --rpc-url "$RPC_URL" 2>/dev/null | head -c 20 || echo "")
|
|
|
|
if [ "$BRIDGE9_CODE" != "0x" ] && [ -n "$BRIDGE9_CODE" ]; then
|
|
log_success "WETH9 Bridge already deployed: $BRIDGE9"
|
|
else
|
|
log_warn "WETH9 Bridge not deployed"
|
|
fi
|
|
|
|
if [ "$BRIDGE10_CODE" != "0x" ] && [ -n "$BRIDGE10_CODE" ]; then
|
|
log_success "WETH10 Bridge already deployed: $BRIDGE10"
|
|
else
|
|
log_warn "WETH10 Bridge not deployed"
|
|
fi
|
|
|
|
echo ""
|
|
|
|
# Deployment function
|
|
deploy_contract() {
|
|
local SCRIPT_NAME=$1
|
|
local CONTRACT_NAME=$2
|
|
local NONCE=$3
|
|
|
|
log_section "Deploying $CONTRACT_NAME"
|
|
|
|
if [ ! -f "$SCRIPT_DIR/script/$SCRIPT_NAME" ]; then
|
|
log_error "Script not found: $SCRIPT_DIR/script/$SCRIPT_NAME"
|
|
return 1
|
|
fi
|
|
|
|
log_info "Using nonce: $NONCE"
|
|
log_info "Using gas price: $GAS_PRICE"
|
|
|
|
cd "$SCRIPT_DIR" || exit 1
|
|
|
|
# Deploy using forge script with explicit nonce and gas price
|
|
log_info "Running deployment..."
|
|
|
|
DEPLOY_OUTPUT=$(forge script "script/$SCRIPT_NAME" \
|
|
--rpc-url "$RPC_URL" \
|
|
--broadcast \
|
|
--nonce "$NONCE" \
|
|
--gas-price "$GAS_PRICE" \
|
|
-vvv 2>&1 || echo "DEPLOY_FAILED")
|
|
|
|
if echo "$DEPLOY_OUTPUT" | grep -q "DEPLOY_FAILED\|Error\|Failed"; then
|
|
log_error "Deployment failed"
|
|
echo "$DEPLOY_OUTPUT" | tail -20
|
|
return 1
|
|
fi
|
|
|
|
# Extract contract address from output
|
|
CONTRACT_ADDRESS=$(echo "$DEPLOY_OUTPUT" | grep -iE "deployed at|address:" | grep -oE "0x[a-fA-F0-9]{40}" | head -1 || echo "")
|
|
|
|
if [ -n "$CONTRACT_ADDRESS" ]; then
|
|
log_success "$CONTRACT_NAME deployed at: $CONTRACT_ADDRESS"
|
|
|
|
# Verify deployment
|
|
sleep 5
|
|
CODE=$(cast code "$CONTRACT_ADDRESS" --rpc-url "$RPC_URL" 2>/dev/null | head -c 20 || echo "")
|
|
if [ "$CODE" != "0x" ] && [ -n "$CODE" ]; then
|
|
log_success "Contract verified (has code)"
|
|
else
|
|
log_warn "Contract may not be deployed yet (waiting for confirmation)"
|
|
fi
|
|
|
|
return 0
|
|
else
|
|
log_warn "Could not extract contract address from output"
|
|
return 1
|
|
fi
|
|
}
|
|
|
|
# Check what needs to be deployed
|
|
log_section "Deployment Plan"
|
|
|
|
NEEDS_DEPLOY=false
|
|
|
|
if [ "$BRIDGE9_CODE" = "0x" ] || [ -z "$BRIDGE9_CODE" ]; then
|
|
log_info "WETH9 Bridge needs deployment"
|
|
NEEDS_DEPLOY=true
|
|
else
|
|
log_success "WETH9 Bridge already deployed"
|
|
fi
|
|
|
|
if [ "$BRIDGE10_CODE" = "0x" ] || [ -z "$BRIDGE10_CODE" ]; then
|
|
log_info "WETH10 Bridge needs deployment"
|
|
NEEDS_DEPLOY=true
|
|
else
|
|
log_success "WETH10 Bridge already deployed"
|
|
fi
|
|
|
|
if [ "$NEEDS_DEPLOY" = false ]; then
|
|
log_success "All contracts already deployed!"
|
|
echo ""
|
|
echo "Bridges are deployed and ready to use:"
|
|
echo " WETH9 Bridge: $BRIDGE9"
|
|
echo " WETH10 Bridge: $BRIDGE10"
|
|
exit 0
|
|
fi
|
|
|
|
# Deploy missing contracts
|
|
echo ""
|
|
log_section "Starting Deployments"
|
|
|
|
CURRENT_NONCE=$NEXT_NONCE
|
|
|
|
if [ "$BRIDGE9_CODE" = "0x" ] || [ -z "$BRIDGE9_CODE" ]; then
|
|
if deploy_contract "DeployCCIPWETH9Bridge.s.sol" "CCIPWETH9Bridge" "$CURRENT_NONCE"; then
|
|
CURRENT_NONCE=$((CURRENT_NONCE + 1))
|
|
else
|
|
log_error "WETH9 Bridge deployment failed"
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
if [ "$BRIDGE10_CODE" = "0x" ] || [ -z "$BRIDGE10_CODE" ]; then
|
|
if deploy_contract "DeployCCIPWETH10Bridge.s.sol" "CCIPWETH10Bridge" "$CURRENT_NONCE"; then
|
|
CURRENT_NONCE=$((CURRENT_NONCE + 1))
|
|
else
|
|
log_error "WETH10 Bridge deployment failed"
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
log_section "Deployment Complete"
|
|
|
|
echo "Next nonce after deployments: $CURRENT_NONCE"
|
|
echo ""
|
|
log_success "All deployments completed!"
|