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 thesauce 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.USDCis the Pot’s balance of the chain’sUSDCtoken. 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, sopoolis a different address per chain.bCSPXis 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
--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
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.0x88e6…5640 on Ethereum and 0xd0b5…F224 on Base, from the same line of source.
Next steps
- Rebalance: trade the Pot’s WETH and USDC back to a target share.
- Buy a tokenized stock: swap into a tokenized stock.
- Names, Tokens reference, Chains reference,
sauce compile.
