feat: restore operator WIP — PMM JSON sync entrypoint, dotenv RPC trim + secrets, pool env alignment

- Resolve stash: merge load_deployment_env path with secure-secrets and CR/LF RPC strip
- create-pmm-full-mesh-chain138.sh delegates to sync-chain138-pmm-pools-from-json.sh
- env.additions.example: canonical PMM pool defaults (cUSDT/USDT per crosscheck)
- Include Chain138 scripts, official mirror deploy scaffolding, and prior staged changes

Made-with: Cursor
This commit is contained in:
defiQUG
2026-03-27 19:02:30 -07:00
parent c6e7bad15e
commit 2a4753eb2d
200 changed files with 5987 additions and 913 deletions

View File

@@ -20,12 +20,15 @@ log_success() { echo -e "${GREEN}[✓]${NC} $1"; }
log_warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
log_error() { echo -e "${RED}[ERROR]${NC} $1"; }
# Load environment
if [ -f "$PROJECT_ROOT/.env" ]; then
if [[ -f "$PROJECT_ROOT/scripts/lib/deployment/dotenv.sh" ]]; then
# shellcheck disable=SC1090
source "$PROJECT_ROOT/scripts/lib/deployment/dotenv.sh"
load_deployment_env --repo-root "$PROJECT_ROOT"
elif [ -f "$PROJECT_ROOT/.env" ]; then
source "$PROJECT_ROOT/.env" 2>/dev/null || true
fi
if [ -z "$PRIVATE_KEY" ]; then
if [ -z "${PRIVATE_KEY:-}" ]; then
log_error "PRIVATE_KEY not set in .env"
exit 1
fi

View File

@@ -7,6 +7,7 @@ set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
cd "$PROJECT_ROOT" 2>/dev/null || true
# Colors
RED='\033[0;31m'
@@ -21,12 +22,15 @@ log_success() { echo -e "${GREEN}[✓]${NC} $1"; }
log_warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
log_error() { echo -e "${RED}[ERROR]${NC} $1"; }
# Load environment
if [ -f "$PROJECT_ROOT/.env" ]; then
if [[ -f "$PROJECT_ROOT/scripts/lib/deployment/dotenv.sh" ]]; then
# shellcheck disable=SC1090
source "$PROJECT_ROOT/scripts/lib/deployment/dotenv.sh"
load_deployment_env --repo-root "$PROJECT_ROOT"
elif [ -f "$PROJECT_ROOT/.env" ]; then
source "$PROJECT_ROOT/.env" 2>/dev/null || true
fi
if [ -z "$PRIVATE_KEY" ]; then
if [ -z "${PRIVATE_KEY:-}" ]; then
log_error "PRIVATE_KEY not set in .env"
exit 1
fi

View File

@@ -1,14 +1,24 @@
#!/usr/bin/env bash
# Full bidirectional bridge configuration (Ethereum mainnet ↔ Chain 138).
# Legacy scripts under scripts/configuration/configure-chain138-* were removed; this delegates to deployment helpers.
# Execute Full Bidirectional Bridge Configuration
# This script attempts to configure both directions using available selector information
set -e
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
cd "$PROJECT_ROOT"
if [[ -f "$SCRIPT_DIR/../lib/deployment/dotenv.sh" ]]; then
# shellcheck disable=SC1090
source "$SCRIPT_DIR/../lib/deployment/dotenv.sh"
load_deployment_env --repo-root "$PROJECT_ROOT"
elif [[ -f "$PROJECT_ROOT/.env" ]]; then
set -a
# shellcheck disable=SC1090
source "$PROJECT_ROOT/.env"
set +a
fi
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
@@ -16,54 +26,21 @@ BLUE='\033[0;34m'
NC='\033[0m'
log_info() { echo -e "${BLUE}[INFO]${NC} $1"; }
log_warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
log_success() { echo -e "${GREEN}[✓]${NC} $1"; }
log_warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
log_error() { echo -e "${RED}[ERROR]${NC} $1"; }
log_info "=== Full Bidirectional Bridge Configuration ==="
log_info ""
log_info "=== Mainnet ↔ Chain 138 (WETH9/WETH10 bridges) ==="
bash "$PROJECT_ROOT/scripts/deployment/execute-bridge-config.sh" || log_warn "execute-bridge-config.sh exited non-zero (review output)."
# Load environment if available
if [ -f "$PROJECT_ROOT/.env" ]; then
source "$PROJECT_ROOT/.env" 2>/dev/null || true
fi
log_info "=== Config-ready chains (Gnosis/Cronos/Celo/Wemix) ==="
log_info "When bridge addresses are in .env, run: scripts/deployment/complete-config-ready-chains.sh"
# Step 1: Configure ChainID 138 → Mainnet (always possible)
log_info "Step 1: Configuring ChainID 138 → Mainnet..."
./scripts/configuration/configure-chain138-to-mainnet.sh
log_info ""
log_info "---"
# Step 2: Try to configure Mainnet → ChainID 138 (if selector available)
log_info "Step 2: Attempting Mainnet → ChainID 138 configuration..."
# Get selector from networks.json if not in env
if [ -z "$CHAIN138_SELECTOR" ] && [ -f "$PROJECT_ROOT/networks.json" ]; then
CHAIN138_SELECTOR=$(python3 -c "import json; data=json.load(open('$PROJECT_ROOT/networks.json')); print(data['networks']['138']['chainSelector'])" 2>/dev/null || echo "")
if [ -n "$CHAIN138_SELECTOR" ]; then
log_info "Using ChainID 138 selector from networks.json: $CHAIN138_SELECTOR"
export CHAIN138_SELECTOR
fi
fi
if [ -n "$CHAIN138_SELECTOR" ]; then
./scripts/configuration/configure-mainnet-to-chain138.sh
log_success "✓ Bidirectional configuration complete!"
log_info "=== Optional verification ==="
if [[ -x "$PROJECT_ROOT/scripts/verify-bridge-setup-checklist.sh" ]]; then
bash "$PROJECT_ROOT/scripts/verify-bridge-setup-checklist.sh" || log_warn "Checklist reported issues (non-fatal)."
else
log_warn "⚠ ChainID 138 selector not available - only ChainID 138 → Mainnet configured"
log_info "To complete bidirectional setup:"
log_info "1. Determine ChainID 138 selector"
log_info "2. Set in .env: CHAIN138_SELECTOR=<selector>"
log_info "3. Run: ./scripts/configuration/configure-mainnet-to-chain138.sh"
log_warn "verify-bridge-setup-checklist.sh not found or not executable."
fi
log_info ""
log_info "---"
# Step 3: Verify configuration
log_info "Step 3: Verifying configuration..."
./scripts/configuration/verify-bridge-configuration.sh
log_info ""
log_success "=== Configuration Process Complete ==="
log_success "=== Done ==="

View File

@@ -19,7 +19,10 @@ log_success() { echo -e "${GREEN}[✓]${NC} $1"; }
log_warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
# Load environment variables
# Default matches operator LAN Core RPC (see project AGENTS.md / rules).
CHAIN138_RPC="${RPC_URL_138:-http://192.168.11.211:8545}"
CHAIN138_RPC="${CHAIN138_RPC%$'\r'}"
CHAIN138_RPC="${CHAIN138_RPC%$'\n'}"
CCIP_ROUTER_138="${CCIP_ROUTER_138:-0x42DAb7b888Dd382bD5Adcf9E038dBF1fD03b4817}"
log_info "=== Finding ChainID 138 CCIP Selector ==="