Standardize deployment env and deployer handling

This commit is contained in:
defiQUG
2026-04-22 14:47:28 -07:00
parent 768168de5e
commit c3d4c786fa
51 changed files with 424 additions and 621 deletions

View File

@@ -25,23 +25,14 @@ elif [[ -n "${REPO_ROOT:-}" && -f "$REPO_ROOT/.env" ]]; then
set +a
fi
# Load environment variables
if [ ! -f .env ]; then
log_error "Error: .env file not found"
echo "Please create .env file with required variables"
exit 1
fi
source .env
# Check required variables
if [ -z "$PRIVATE_KEY" ]; then
log_error "Error: PRIVATE_KEY not set in .env"
if ! require_private_key_env; then
exit 1
fi
RPC_URL="${RPC_URL:-${RPC_URL_138:-${CHAIN138_RPC_URL:-}}}"
if [ -z "$RPC_URL" ]; then
log_error "Error: RPC_URL not set in .env"
log_error "ERROR: Chain 138 RPC not available. Set RPC_URL, RPC_URL_138, or CHAIN138_RPC_URL."
exit 1
fi
@@ -137,11 +128,8 @@ wait $MULTICALL_PID
wait $WETH9_PID
wait $WETH10_PID
# Reload .env to get deployed addresses
source .env
# Phase 2: CCIP Router (if needed)
if [ -z "$CCIP_ROUTER" ] || [ "$CCIP_ROUTER" = "0x0000000000000000000000000000000000000000" ]; then
if [ -z "${CCIP_ROUTER:-}" ] || [ "${CCIP_ROUTER:-}" = "0x0000000000000000000000000000000000000000" ]; then
log_warn "Phase 2: Deploying CCIP Router..."
CCIP_ROUTER_OUTPUT=$(forge_scoped script script/DeployCCIPRouter.s.sol:DeployCCIPRouter \
--sig "run(address,uint256,uint256)" \
@@ -161,11 +149,8 @@ else
log_success "✅ CCIP Router already configured: $CCIP_ROUTER"
fi
# Reload .env
source .env
# Phase 3: Bridge contracts (can be deployed in parallel if dependencies are met)
if [ "${DEPLOY_BRIDGES:-true}" = "true" ] && [ -n "$CCIP_ROUTER" ] && [ -n "$WETH9_ADDRESS" ] && [ -n "$WETH10_ADDRESS" ]; then
if [ "${DEPLOY_BRIDGES:-true}" = "true" ] && [ -n "${CCIP_ROUTER:-}" ] && [ -n "${WETH9_ADDRESS:-}" ] && [ -n "${WETH10_ADDRESS:-}" ]; then
log_warn "Phase 3: Deploying CCIP bridges in parallel..."
{
@@ -234,7 +219,7 @@ log_warn "Phase 4: Deploying Oracle and MultiSig in parallel..."
ORACLE_PID=$!
# Deploy MultiSig (independent if owners are set)
if [ -z "$MULTISIG_OWNERS" ]; then
if [ -z "${MULTISIG_OWNERS:-}" ]; then
log_warn "⚠️ MULTISIG_OWNERS not set. Skipping MultiSig deployment."
log_warn "Set MULTISIG_OWNERS in .env (comma-separated addresses) to deploy."
MULTISIG_PID=""
@@ -261,12 +246,8 @@ if [ -n "$MULTISIG_PID" ]; then
wait $MULTISIG_PID
fi
# Reload .env to get all new addresses
source .env
# Final summary
log_success "=== Deployment Summary ==="
source .env
log_success "Multicall: ${MULTICALL_ADDRESS:-N/A}"
log_success "WETH9: ${WETH9_ADDRESS:-N/A}"
log_success "WETH10: ${WETH10_ADDRESS:-N/A}"