Skip to Content
ReferenceCLIFollow Mainnet State

Follow Mainnet State

Pin contract state to the live chain your Stagenet forks, from the command line. A followed account or slot always reads the current mainnet value — even after transactions on your Stagenet have written to it. Use it to keep DEX pools, market-maker inventory, and oracles live on a long-lived Stagenet.

This CLI wraps the mainnet-follow SDK methods. For the full mechanics see Mainnet Follow.

Usage

With a contract.dev.js at your project root (see Setup):

contract.dev follow <address|subcommand> # start following / list contract.dev unfollow <address> # stop following (mirrors follow's flags)

Follow a whole contract

Follows everything on the contract: every storage slot, plus the account record (ETH balance, nonce) and its code. For contracts holding only market state — AMM pools, settlement contracts, oracles:

contract.dev follow 0xc9034c3E7F58003E6ae0C8438e7c8f4598d5ACAA
Following 0xc9034c3e7f58003e6ae0c8438e7c8f4598d5acaa — its entire state (storage, balance, nonce, code) reads live mainnet from now on cleared 623 locally-persisted slot(s)

Follow one balance on a token

For shared contracts like tokens, follow a specific holder’s balance instead of the whole contract — the storage slot is discovered automatically:

contract.dev follow 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 --balance-of 0x67336CeC42645F55059efF241CB02eA5cC52FF86
Following balanceOf(0x67336cec42645f55059eff241cb02ea5cc52ff86) on 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 — reads live mainnet from now on slot: 0x6e91f60197c982353033e86512311820683e018e0f39963c5d00c2c490bc45d3

Follow specific slots

When you know the slot keys — full 32-byte hex, or plain decimal for declared slots:

contract.dev follow 0xA0b8…eB48 --slots 0x6e91…45d3,0x12ab…90ff contract.dev follow 0xc903…ACAA --slots 0,1,4 # declared slots (e.g. slot0, fee growth)

Decimal entries are slot numbers: 10 means slot ten, not 0x10. Hex keys need the 0x prefix.

unfollow

Stop following — mirrors the flags of the follow form. Local history is cleared, so the state behaves as never-touched (live until your next write).

contract.dev unfollow 0xc9034c3E7F58003E6ae0C8438e7c8f4598d5ACAA contract.dev unfollow 0xA0b8…eB48 --balance-of 0x6733…FF86 contract.dev unfollow 0xA0b8…eB48 --slots 0x6e91…45d3

follow list

Print everything currently followed:

contract.dev follow list
Followed accounts (entire state live — storage, balance, nonce, code): 0xc9034c3e7f58003e6ae0c8438e7c8f4598d5acaa Followed slots: 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 0x6e91f60197c982353033e86512311820683e018e0f39963c5d00c2c490bc45d3
ArgumentDescription
<address>The contract to follow / stop following
--balance-of <holder>Follow only balanceOf[holder] on a token (slot auto-discovered)
--slots <s1,s2,…>Follow specific slots: 0x-prefixed 32-byte keys or decimal slot numbers
Last updated on