- Update dbis_core, cross-chain-pmm-lps, explorer-monorepo, metamask-integration, pr-workspace/chains - Omit embedded publish git dirs and empty placeholders from index Made-with: Cursor
130 lines
5.7 KiB
Bash
Executable File
130 lines
5.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# Verify the first public Mainnet DODO PMM cW bootstrap pools.
|
|
# Checks:
|
|
# - pool env present
|
|
# - integration mapping points at the expected pool
|
|
# - reserves are non-zero
|
|
# - the repeatable swap helper dry-runs cleanly with the expected quote fallback
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
REPO_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)"
|
|
STATUS_JSON="${REPO_ROOT}/cross-chain-pmm-lps/config/deployment-status.json"
|
|
|
|
source "${REPO_ROOT}/smom-dbis-138/scripts/load-env.sh" >/dev/null 2>&1
|
|
|
|
require_cmd() {
|
|
command -v "$1" >/dev/null 2>&1 || {
|
|
echo "[fail] missing required command: $1" >&2
|
|
exit 1
|
|
}
|
|
}
|
|
|
|
require_cmd cast
|
|
require_cmd bash
|
|
require_cmd jq
|
|
|
|
RPC_URL="${ETHEREUM_MAINNET_RPC:-}"
|
|
INTEGRATION="${DODO_PMM_INTEGRATION_MAINNET:-}"
|
|
|
|
if [[ -z "$RPC_URL" || -z "$INTEGRATION" ]]; then
|
|
echo "[fail] ETHEREUM_MAINNET_RPC and DODO_PMM_INTEGRATION_MAINNET are required" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [[ ! -f "$STATUS_JSON" ]]; then
|
|
echo "[fail] missing $STATUS_JSON" >&2
|
|
exit 1
|
|
fi
|
|
|
|
pairs=(
|
|
"cwusdt-usdc|cWUSDT|USDC|base-to-quote|1000|POOL_CWUSDT_USDC_MAINNET|${CWUSDT_MAINNET:-0xaF5017d0163ecb99D9B5D94e3b4D7b09Af44D8AE}|0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
|
|
"cwusdc-usdc|cWUSDC|USDC|quote-to-base|1000|POOL_CWUSDC_USDC_MAINNET|${CWUSDC_MAINNET:-0x2de5F116bFcE3d0f922d9C8351e0c5Fc24b9284a}|0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
|
|
"cwusdt-usdt|cWUSDT|USDT|base-to-quote|1000|POOL_CWUSDT_USDT_MAINNET|${CWUSDT_MAINNET:-0xaF5017d0163ecb99D9B5D94e3b4D7b09Af44D8AE}|0xdAC17F958D2ee523a2206206994597C13D831ec7"
|
|
"cwusdc-usdt|cWUSDC|USDT|quote-to-base|1000|POOL_CWUSDC_USDT_MAINNET|${CWUSDC_MAINNET:-0x2de5F116bFcE3d0f922d9C8351e0c5Fc24b9284a}|0xdAC17F958D2ee523a2206206994597C13D831ec7"
|
|
"cwusdt-cwusdc|cWUSDT|cWUSDC|base-to-quote|1000000|POOL_CWUSDT_CWUSDC_MAINNET|${CWUSDT_MAINNET:-0xaF5017d0163ecb99D9B5D94e3b4D7b09Af44D8AE}|${CWUSDC_MAINNET:-0x2de5F116bFcE3d0f922d9C8351e0c5Fc24b9284a}"
|
|
"cweurc-usdc|cWEURC|USDC|base-to-quote|1000|POOL_CWEURC_USDC_MAINNET|${CWEURC_MAINNET:-0xD4aEAa8cD3fB41Dc8437FaC7639B6d91B60A5e8d}|0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
|
|
"cwgbpc-usdc|cWGBPC|USDC|quote-to-base|1000|POOL_CWGBPC_USDC_MAINNET|${CWGBPC_MAINNET:-0xc074007dc0bfb384b1cf6426a56287ed23fe4d52}|0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
|
|
"cwaudc-usdc|cWAUDC|USDC|base-to-quote|1000|POOL_CWAUDC_USDC_MAINNET|${CWAUDC_MAINNET:-0x5020Db641B3Fc0dAbBc0c688C845bc4E3699f35F}|0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
|
|
"cwcadc-usdc|cWCADC|USDC|quote-to-base|1000|POOL_CWCADC_USDC_MAINNET|${CWCADC_MAINNET:-0x209FE32fe7B541751D190ae4e50cd005DcF8EDb4}|0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
|
|
"cwjpyc-usdc|cWJPYC|USDC|base-to-quote|1000|POOL_CWJPYC_USDC_MAINNET|${CWJPYC_MAINNET:-0x07EEd0D7dD40984e47B9D3a3bdded1c536435582}|0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
|
|
"cwchfc-usdc|cWCHFC|USDC|quote-to-base|1000|POOL_CWCHFC_USDC_MAINNET|${CWCHFC_MAINNET:-0x0F91C5E6Ddd46403746aAC970D05d70FFe404780}|0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
|
|
)
|
|
|
|
failures=0
|
|
|
|
echo "=== Mainnet Public DODO cW Bootstrap Pools ==="
|
|
echo "Integration: $INTEGRATION"
|
|
echo "RPC: $RPC_URL"
|
|
|
|
for row in "${pairs[@]}"; do
|
|
IFS='|' read -r pair base_symbol quote_symbol direction amount pool_env_key base_token quote_token <<<"$row"
|
|
|
|
configured_pool="${!pool_env_key:-}"
|
|
status_pool="$(jq -r --arg b "$base_symbol" --arg q "$quote_symbol" '.chains["1"].pmmPools[]? | select(.base == $b and .quote == $q) | .poolAddress' "$STATUS_JSON" | head -n1)"
|
|
if [[ -n "$status_pool" && "$status_pool" != "null" ]]; then
|
|
pool="$status_pool"
|
|
else
|
|
pool="$configured_pool"
|
|
fi
|
|
|
|
if [[ -z "$pool" ]]; then
|
|
echo "[fail] $pair missing pool address in registry/env" >&2
|
|
failures=$((failures + 1))
|
|
continue
|
|
fi
|
|
|
|
mapped_pool="$(cast call "$INTEGRATION" 'pools(address,address)(address)' "$base_token" "$quote_token" --rpc-url "$RPC_URL" 2>/dev/null | awk '{print $1}')"
|
|
reserve_output="$(cast call "$pool" 'getVaultReserve()(uint256,uint256)' --rpc-url "$RPC_URL" 2>/dev/null || true)"
|
|
base_reserve="$(printf '%s\n' "$reserve_output" | sed -n '1p' | awk '{print $1}')"
|
|
quote_reserve="$(printf '%s\n' "$reserve_output" | sed -n '2p' | awk '{print $1}')"
|
|
|
|
if [[ "$mapped_pool" != "$pool" ]]; then
|
|
echo "[fail] $pair integration mapping mismatch: expected $pool got ${mapped_pool:-<empty>}" >&2
|
|
failures=$((failures + 1))
|
|
continue
|
|
fi
|
|
|
|
if [[ -z "$base_reserve" || -z "$quote_reserve" || "$base_reserve" == "0" || "$quote_reserve" == "0" ]]; then
|
|
echo "[fail] $pair has zero/unknown reserves" >&2
|
|
failures=$((failures + 1))
|
|
continue
|
|
fi
|
|
|
|
dry_run_output="$(
|
|
bash "${REPO_ROOT}/scripts/deployment/run-mainnet-public-dodo-cw-swap.sh" \
|
|
--pair="$pair" \
|
|
--direction="$direction" \
|
|
--amount="$amount" \
|
|
--dry-run
|
|
)"
|
|
|
|
quote_source="$(printf '%s\n' "$dry_run_output" | awk -F= '/^quoteSource=/ {print $2}')"
|
|
estimated_out="$(printf '%s\n' "$dry_run_output" | awk -F= '/^estimatedOut=/ {print $2}')"
|
|
min_out="$(printf '%s\n' "$dry_run_output" | awk -F= '/^minOut=/ {print $2}')"
|
|
|
|
echo "- $pair"
|
|
echo " pool=$pool"
|
|
if [[ -n "$configured_pool" && "${configured_pool,,}" != "${pool,,}" ]]; then
|
|
echo " note=env_pool_overridden_by_registry"
|
|
echo " configuredPool=$configured_pool"
|
|
fi
|
|
echo " mappedPool=$mapped_pool"
|
|
echo " reserves=$base_reserve/$quote_reserve"
|
|
echo " dryRunDirection=$direction"
|
|
echo " dryRunAmount=$amount"
|
|
echo " quoteSource=${quote_source:-unknown}"
|
|
echo " estimatedOut=${estimated_out:-unknown}"
|
|
echo " minOut=${min_out:-unknown}"
|
|
done
|
|
|
|
if (( failures > 0 )); then
|
|
echo
|
|
echo "[WARN] Bootstrap pool verification found $failures issue(s)." >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo
|
|
echo "Result: all 11 recorded Mainnet public DODO cW bootstrap pools are mapped, funded, and dry-run routable."
|