#!/usr/bin/env bash
# Deploy Vault System (VLT-010 to VLT-018)
# Requires: PRIVATE_KEY, RPC_URL (ChainID 138)
# Optional: TREASURY_ADDRESS

set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
cd "$PROJECT_ROOT"

source "$PROJECT_ROOT/scripts/load-env.sh" >/dev/null 2>&1 || true

: "${PRIVATE_KEY:?PRIVATE_KEY required}"
: "${RPC_URL:?RPC_URL required (e.g. http://192.168.11.250:8545)}"

echo "Deploying Vault System..."
forge script script/deploy/vault/DeployVaultSystem.s.sol:DeployVaultSystem \
  --rpc-url "$RPC_URL" \
  --broadcast \
  --verify
