- 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
83 lines
2.8 KiB
Bash
83 lines
2.8 KiB
Bash
#!/usr/bin/env bash
|
|
# Summarize cW* public-chain deployment status from cross-chain-pmm-lps/config/deployment-status.json.
|
|
# Usage:
|
|
# bash scripts/verify/check-cw-public-pool-status.sh
|
|
# bash scripts/verify/check-cw-public-pool-status.sh --json
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
export PROJECT_ROOT
|
|
|
|
OUTPUT_JSON=0
|
|
for arg in "$@"; do
|
|
case "$arg" in
|
|
--json) OUTPUT_JSON=1 ;;
|
|
*)
|
|
echo "Unknown argument: $arg" >&2
|
|
exit 2
|
|
;;
|
|
esac
|
|
done
|
|
|
|
command -v node >/dev/null 2>&1 || {
|
|
echo "[FAIL] Missing required command: node" >&2
|
|
exit 1
|
|
}
|
|
|
|
OUTPUT_JSON="$OUTPUT_JSON" node <<'NODE'
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const root = process.env.PROJECT_ROOT;
|
|
const outputJson = process.env.OUTPUT_JSON === '1';
|
|
const statusPath = path.join(root, 'cross-chain-pmm-lps/config/deployment-status.json');
|
|
const status = JSON.parse(fs.readFileSync(statusPath, 'utf8'));
|
|
|
|
const rows = Object.entries(status.chains || {}).map(([chainId, chain]) => {
|
|
const cwTokens = Object.keys(chain.cwTokens || {});
|
|
const pmmPools = Array.isArray(chain.pmmPools) ? chain.pmmPools : [];
|
|
const pmmVolatile = Array.isArray(chain.pmmPoolsVolatile) ? chain.pmmPoolsVolatile : [];
|
|
const pmmTotal = pmmPools.length + pmmVolatile.length;
|
|
return {
|
|
chainId: Number(chainId),
|
|
name: chain.name,
|
|
cwTokenCount: cwTokens.length,
|
|
pmmPoolCount: pmmPools.length,
|
|
pmmVolatilePoolCount: pmmVolatile.length,
|
|
pmmPoolTotal: pmmTotal,
|
|
bridgeAvailable: chain.bridgeAvailable,
|
|
cwTokens
|
|
};
|
|
}).sort((a, b) => a.chainId - b.chainId);
|
|
|
|
const summary = {
|
|
chainsChecked: rows.length,
|
|
chainsWithCwTokens: rows.filter((r) => r.cwTokenCount > 0).length,
|
|
chainsWithAnyPmmPools: rows.filter((r) => r.pmmPoolTotal > 0).length,
|
|
chainsWithBridgeAvailable: rows.filter((r) => r.bridgeAvailable === true).length
|
|
};
|
|
|
|
if (outputJson) {
|
|
console.log(JSON.stringify({ summary, rows }, null, 2));
|
|
process.exit(0);
|
|
}
|
|
|
|
console.log('=== cW* Public-Chain Pool Status ===');
|
|
console.log(`Chains checked: ${summary.chainsChecked}`);
|
|
console.log(`Chains with cW* tokens: ${summary.chainsWithCwTokens}`);
|
|
console.log(`Chains with bridgeAvailable=true: ${summary.chainsWithBridgeAvailable}`);
|
|
console.log(`Chains with any PMM pools: ${summary.chainsWithAnyPmmPools}`);
|
|
|
|
for (const row of rows) {
|
|
const bridge = row.bridgeAvailable === true ? 'bridge' : row.bridgeAvailable === false ? 'no-bridge' : 'bridge-unknown';
|
|
const pv = row.pmmVolatilePoolCount > 0 ? `+volatile=${row.pmmVolatilePoolCount}` : '';
|
|
console.log(`- ${row.chainId} ${row.name}: cw=${row.cwTokenCount}, pools=${row.pmmPoolCount}${pv}, ${bridge}`);
|
|
}
|
|
|
|
if (summary.chainsWithAnyPmmPools === 0) {
|
|
console.log('Result: deployment-status.json records no live public-chain cW* PMM pools.');
|
|
}
|
|
NODE
|