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
64 lines
2.0 KiB
Bash
Executable File
64 lines
2.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Create all three DODO PMM pools on Chain 138: cUSDT/cUSDC, cUSDT/USDT, cUSDC/USDC.
|
|
# Requires: DODOPMMIntegration deployed, deployer with POOL_MANAGER_ROLE, PRIVATE_KEY and RPC_URL_138 in smom-dbis-138/.env.
|
|
#
|
|
# Usage: ./scripts/deployment/create-all-pmm-pools-chain138.sh [--dry-run]
|
|
# --dry-run Print commands only; do not broadcast.
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
SMOM="${PROJECT_ROOT}/smom-dbis-138"
|
|
|
|
DRY_RUN=""
|
|
for a in "$@"; do
|
|
[[ "$a" == "--dry-run" ]] && DRY_RUN=1
|
|
done
|
|
|
|
if [[ ! -f "$SMOM/.env" ]]; then
|
|
echo "Missing $SMOM/.env. Abort." >&2
|
|
exit 1
|
|
fi
|
|
set -a
|
|
source "$SMOM/.env"
|
|
set +a
|
|
|
|
RPC="${RPC_URL_138:-http://192.168.11.211:8545}"
|
|
GAS_PRICE="${GAS_PRICE_138:-${GAS_PRICE:-1000000000}}"
|
|
export DODO_PMM_INTEGRATION="${DODO_PMM_INTEGRATION_ADDRESS:-${DODO_PMM_INTEGRATION:-0x79cdbaFBaA0FdF9F55D26F360F54cddE5c743F7D}}"
|
|
export RPC_URL_138="$RPC"
|
|
|
|
cd "$SMOM"
|
|
|
|
POOLS=(
|
|
"script/dex/CreateCUSDTCUSDCPool.s.sol:CreateCUSDTCUSDCPool"
|
|
"script/dex/CreateCUSDTUSDTPool.s.sol:CreateCUSDTUSDTPool"
|
|
"script/dex/CreateCUSDCUSDCPool.s.sol:CreateCUSDCUSDCPool"
|
|
)
|
|
|
|
if [[ -n "$DRY_RUN" ]]; then
|
|
echo "[dry-run] Would run the following (from $SMOM):"
|
|
for spec in "${POOLS[@]}"; do
|
|
echo " forge script $spec --rpc-url \"$RPC\" --broadcast --private-key \"\$PRIVATE_KEY\" --with-gas-price $GAS_PRICE"
|
|
done
|
|
exit 0
|
|
fi
|
|
|
|
for spec in "${POOLS[@]}"; do
|
|
echo "=== Creating pool: $spec ==="
|
|
out=$(forge script $spec --rpc-url "$RPC" --broadcast --private-key "$PRIVATE_KEY" --with-gas-price "$GAS_PRICE" 2>&1) || true
|
|
echo "$out"
|
|
if echo "$out" | grep -qE "pool exists|Pool already exists"; then
|
|
echo "Pool already exists; skipping."
|
|
elif echo "$out" | grep -q "Error:" && ! echo "$out" | grep -qE "pool exists|Pool already exists"; then
|
|
echo "Pool creation failed (see above)." >&2
|
|
exit 1
|
|
else
|
|
echo "Pool created successfully."
|
|
fi
|
|
sleep 2
|
|
done
|
|
|
|
echo "Done. Run ./scripts/verify/check-contracts-on-chain-138.sh \"$RPC\" to verify."
|