feat(scripts): pnpm balances — read treasury USDC across all chains#15
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Reviewer orientation — multi-EVM stack [6/6]Top of the stack. This PR is independent of the multi-EVM rollout's surface area — it's a dev-only CLI tool. Safe to review last and merge last.
You're at the top. No next PR. Adds a read-only `pnpm balances` script that walks every mainnet chain in the registry and prints `usdc.balanceOf(treasury)` per chain. Used by the maintainer to track broker-fee revenue between manual sweeps. Adds `tsx` as a devDep. No surface change to users. |
fielding
left a comment
There was a problem hiding this comment.
No blockers in this script layer.
I ran:
NO_COLOR=1 pnpm balances 0x847F640bE052b0700C31F72Dce622F4C6286934E
NO_COLOR=1 pnpm balances 0xnotanaddressThe happy path printed the treasury table and handled the Ethereum public RPC 429 inline without blocking the other chains. The invalid-address path exits 1 and prints a clear script-level error. pnpm adds its normal lifecycle failure wrapper after that, but the script itself is doing the right thing.
This PR is still merge-last and should wait for the lower-stack fixes/smoke test, but I do not see any issues in the CLI change itself.
49a2f03 to
e1fdde5
Compare
9da9379 to
4bc3288
Compare
e1fdde5 to
5896c8e
Compare
…ains A read-only CLI for checking the treasury (or any address) on every mainnet chain in the registry. Run \`pnpm balances\` for the default treasury, or \`pnpm balances 0xAddr\` for any address (cold-storage sweep target, etc.). Reads CHAINS directly from chains.ts, so adding a chain to the registry auto-includes it here — no parallel list to maintain. Uses each chain's default public RPC via viem (no API key, no env config). Short timeout + no retries means a single slow public RPC (Ethereum's free tier rate-limits aggressively) doesn't block the whole script. Output: tight table with non-zero balances in cyan, zeros dim, errors shown inline per chain. Total at the bottom is a sum of displayed values across chains; treats Binance-Peg USDC on BNB and Circle USDC elsewhere as 1:1 for the purposes of "did the treasury earn anything". Refs: RG-644a80 (treasury monitoring helper) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
4bc3288 to
8c393c2
Compare
Summary
Stacked on top of the multi-EVM stack (#14 → ... → main). Adds a read-only CLI for checking treasury balances across every mainnet chain in the registry.
Output
(Above is from a real run against the live treasury — Base shows ~$0.05 in real broker fees collected since launch. The Ethereum 429 is the expected behavior of free public RPCs rate-limiting; rerun if you need that one.)
Non-zero balances render in cyan when stdout is a TTY. Zeros and errors are dim. Errors render inline so a single bad RPC doesn't block the rest.
Implementation
Why a CLI and not a cron + webhook
You asked for the simplest thing: hourly reads via a script. No cron, no webhook, no state. Run it when you want to know. The user-controlled cadence beats a noisy automated channel for a treasury you sweep manually anyway.
Test plan
🤖 Generated with Claude Code