Skip to main content
The program returns what the Pot holds in USDC, WETH and bCSPX, and the address of the chain’s Uniswap V3 USDC/WETH pool at fee. It names no chain and no address: --chain decides which token and factory each name resolves to. It moves nothing, and reverts only when the chain has no pool at fee. Target chains: Ethereum and Base. Both registries have every name the file uses. On Arc, sauce compile refuses the file: Arc’s registry has no bCSPX.

Prerequisites

You need the sauce command (npm install -g @eco-incorp/sauce). See Installation. The program moves nothing, so a simulation returns everything it does; there is no step that sends.

Program

pot is the Pot the program runs on, available without declaring it (Names).
holdings-per-chain.sauce.ts

How it works

  • pot.USDC is the Pot’s balance of the chain’s USDC token. The same expression reads a different contract on Ethereum and on Base.
  • UniswapV3.Factory.getPool(USDC, WETH, fee) asks each chain’s own factory for each chain’s own pair, so pool is a different address per chain.
  • bCSPX is Backed’s tokenized S&P 500 fund, registered on both chains. A name that one chain lacks makes the compile for that chain fail, before anything runs.

Run the example

1

Compile

2

Simulate

The --assume-balance flags give the Pot 100 USDC, 0.5 WETH and 2 bCSPX for the simulation only, so the balances it returns are not zero. Without them it returns the Pot’s real balances.
3

List what each name resolved to

The defines field lists each token name with its address on that chain, and contracts lists UniswapV3.Factory with its address.

Simulation result

Simulated on a local fork of Ethereum at block 26252095 and on a local fork of Base at block 52965104, with the current contracts and the commands above. Nothing was signed or sent.
The first result is Ethereum, the second Base. The balances are the assumed ones, in each token’s base units: 100 USDC (6 decimals), 0.5 WETH and 2 bCSPX (18 decimals). The 0.05% pool is 0x88e6…5640 on Ethereum and 0xd0b5…F224 on Base, from the same line of source.

Next steps