Files
proxmox/scripts/verify/check-pmm-pool-balances-chain138.sh
defiQUG 3f76bc9507
Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
docs: update master documentation and push to Gitea (2026-03-06)
- MASTER_INDEX: Last Updated 2026-03-06; status 59/59 contracts; add NEXT_STEPS_LIST, CONTRACT_NEXT_STEPS_LIST
- docs/README, NEXT_STEPS_INDEX, 06-besu/MASTER_INDEX: Last Updated 2026-03-06
- Contract check script: 59 addresses (PMM, vault/reserve, CompliantFiatTokens); canonical CCIP/router
- New docs: EXECUTION_CHECKLIST, NEXT_STEPS_LIST, DOTENV_AUDIT, ADDITIONAL_PATHS, deployer gas runbook, WEMIX_ACQUISITION_TABLED, etc.
- Config: deployer-gas-routes, cro-wemix-swap-routes, routing-registry, token-mapping
- Scripts: check-contracts-on-chain-138, check-pmm-pool-balances-chain138, deployer-gas-auto-route, acquire-cro-and-wemix-gas
- Operator rule: operator-lan-access-check.mdc

Made-with: Cursor
2026-03-06 19:11:25 -08:00

78 lines
3.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# Check all Chain 138 DODO PMM pool token balances (base + quote).
# Uses eth_call (curl) for compatibility with RPCs that reject some cast call formats.
#
# Usage: ./scripts/verify/check-pmm-pool-balances-chain138.sh [RPC_URL]
# Default RPC: http://192.168.11.211:8545
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
RPC="${1:-${RPC_URL_138:-http://192.168.11.211:8545}}"
# Token addresses (Chain 138 canonical)
cUSDT="0x93E66202A11B1772E55407B32B44e5Cd8eda7f22"
cUSDC="0xf22258f57794CC8E06237084b353Ab30fFfa640b"
OFFICIAL_USDT="0x15DF1D5BFDD8Aa4b380445D4e3E9B38d34283619"
# Official USDC from integration or placeholder (no contract on 138)
OFFICIAL_USDC="0x0000000000000000000000000000000000000000"
# Pool addresses
POOL_CUSDTCUSDC="0x9fcB06Aa1FD5215DC0E91Fd098aeff4B62fEa5C8"
POOL_CUSDTUSDT="0xa3Ee6091696B28e5497b6F491fA1e99047250c59"
POOL_CUSDCUSDC="0x90bd9Bf18Daa26Af3e814ea224032d015db58Ea5"
pads() { local a; a=$(echo "$1" | sed 's/0x//'); printf '%064s' "$a" | tr ' ' '0'; }
balance() {
local tok="$1" acc="$2"
local d="0x70a08231$(pads "$acc")"
local res
res=$(curl -s -X POST "$RPC" -H "Content-Type: application/json" \
--data "{\"jsonrpc\":\"2.0\",\"method\":\"eth_call\",\"params\":[{\"to\":\"$tok\",\"data\":\"$d\"},\"latest\"],\"id\":1}" \
| jq -r '.result // empty')
echo "${res:-0x0000000000000000000000000000000000000000000000000000000000000000}"
}
hex2dec() { local h="$1"; [[ -z "$h" || "$h" == "0x" ]] && echo "0" && return; printf '%d' "$h"; }
human6() { local r; r=$(hex2dec "$1"); echo "scale=6; $r / 1000000" | bc 2>/dev/null || echo "$r"; }
echo "=============================================="
echo " Chain 138 — PMM pool balances"
echo " RPC: $RPC"
echo "=============================================="
echo ""
# Pool 1: cUSDT / cUSDC (base / quote)
echo "Pool 1: cUSDT / cUSDC"
echo " Address: $POOL_CUSDTCUSDC"
r1=$(balance "$cUSDT" "$POOL_CUSDTCUSDC")
r2=$(balance "$cUSDC" "$POOL_CUSDTCUSDC")
echo " cUSDT (base): raw=$r1$(human6 "$r1")"
echo " cUSDC (quote): raw=$r2$(human6 "$r2")"
echo ""
# Pool 2: cUSDT / USDT (official USDT has no code on 138)
echo "Pool 2: cUSDT / USDT (official)"
echo " Address: $POOL_CUSDTUSDT"
r1=$(balance "$cUSDT" "$POOL_CUSDTUSDT")
r2=$(balance "$OFFICIAL_USDT" "$POOL_CUSDTUSDT")
echo " cUSDT (base): raw=${r1:-0x0}$(human6 "$r1")"
echo " USDT (quote): raw=${r2:-0x0}$(human6 "$r2")"
echo ""
# Pool 3: cUSDC / USDC (official USDC not deployed on 138)
echo "Pool 3: cUSDC / USDC (official)"
echo " Address: $POOL_CUSDCUSDC"
r1=$(balance "$cUSDC" "$POOL_CUSDCUSDC")
echo " cUSDC (base): raw=$r1$(human6 "$r1")"
if [[ "$OFFICIAL_USDC" != "0x0000000000000000000000000000000000000000" ]]; then
r2=$(balance "$OFFICIAL_USDC" "$POOL_CUSDCUSDC")
echo " USDC (quote): raw=$r2$(human6 "$r2")"
else
echo " USDC (quote): N/A (no official USDC contract on 138)"
fi
echo ""
echo "Note: Pool 1 (cUSDT/cUSDC) is the only pool with liquidity on 138. Pools 2 and 3 use official USDT/USDC which have no contract on Chain 138."
echo "Done."