Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
- ADD_CHAIN138_TO_LEDGER_LIVE: Ledger form done; public code review repo bis-innovations/LedgerLive; init/push commands - CONTRACT_DEPLOYMENT_RUNBOOK: Chain 138 gas price 1 gwei, 36-addr check, TransactionMirror workaround - CONTRACT_*: AddressMapper, MirrorManager deployed 2026-02-12; 36-address on-chain check - NEXT_STEPS_FOR_YOU: Ledger done; steps completable now (no LAN); run-completable-tasks-from-anywhere - MASTER_INDEX, OPERATOR_OPTIONAL, SMART_CONTRACTS_INVENTORY_SIMPLE: updates - LEDGER_BLOCKCHAIN_INTEGRATION_COMPLETE: bis-innovations/LedgerLive reference Co-authored-by: Cursor <cursoragent@cursor.com>
64 lines
1.8 KiB
Bash
Executable File
64 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# GRU M1 On-Chain Supply Check
|
|
# Verifies cUSDC and cUSDT totalSupply() on Chain 138.
|
|
# Usage: ./check-ciso-supply.sh
|
|
# Env: CHAIN_138_RPC_URL, CUSDC_EXPECTED, CUSDT_EXPECTED (optional)
|
|
#
|
|
set -e
|
|
|
|
RPC_URL="${CHAIN_138_RPC_URL:-https://rpc-http-pub.d-bis.org}"
|
|
CUSDC_ADDR="0xf22258f57794CC8E06237084b353Ab30fFfa640b"
|
|
CUSDT_ADDR="0x93E66202A11B1772E55407B32B44e5Cd8eda7f22"
|
|
TOTAL_SUPPLY_SELECTOR="0x18160ddd"
|
|
|
|
get_total_supply() {
|
|
local addr="$1"
|
|
local data='{"jsonrpc":"2.0","method":"eth_call","params":[{"to":"'"$addr"'","data":"'"$TOTAL_SUPPLY_SELECTOR"'"},"latest"],"id":1}'
|
|
local result
|
|
local resp
|
|
resp=$(curl -sL -X POST -H "Content-Type: application/json" -d "$data" "$RPC_URL" 2>/dev/null)
|
|
if command -v jq >/dev/null 2>&1; then
|
|
result=$(echo "$resp" | jq -r '.result // empty')
|
|
else
|
|
result=$(echo "$resp" | grep -o '"result":"[^"]*"' | cut -d'"' -f4)
|
|
fi
|
|
if [[ -z "$result" || "$result" == "0x" || "$result" == "null" ]]; then
|
|
echo "ERROR"
|
|
return 1
|
|
fi
|
|
printf "%d" "$result"
|
|
}
|
|
|
|
fmt_supply() {
|
|
awk -v r="$1" 'BEGIN { printf "%.2f", r/1e6 }'
|
|
}
|
|
|
|
echo "# GRU M1 On-Chain Supply Check"
|
|
echo ""
|
|
echo "RPC: $RPC_URL"
|
|
echo ""
|
|
|
|
for pair in "cUSDC:$CUSDC_ADDR:CUSDC_EXPECTED" "cUSDT:$CUSDT_ADDR:CUSDT_EXPECTED"; do
|
|
IFS=: read -r symbol addr expected_var <<< "$pair"
|
|
expected="${!expected_var:-}"
|
|
raw=$(get_total_supply "$addr" 2>/dev/null) || raw=""
|
|
if [[ -z "$raw" || "$raw" == "ERROR" ]]; then
|
|
echo "$symbol: ERROR (could not fetch)"
|
|
else
|
|
human=$(fmt_supply "$raw")
|
|
if [[ -n "$expected" ]]; then
|
|
if [[ "$raw" == "$expected" ]]; then
|
|
echo "$symbol: $human (PASS)"
|
|
else
|
|
echo "$symbol: $human expected $(fmt_supply "$expected") (FAIL)"
|
|
fi
|
|
else
|
|
echo "$symbol: $human"
|
|
fi
|
|
fi
|
|
done
|
|
|
|
echo ""
|
|
echo "See: docs/gru-m1/PEG_STRESS_TEST_WORKSHEET.md"
|