0xc100000000000000000000000000000000000000. Calling functions on this precompile from inside a transaction lets your contracts manipulate on-chain state directly, storage slots, ETH balances, ERC-20 token balances, nonces, and event logs, without impersonating accounts or deploying helper proxies.
These cheatcodes complement the Admin RPC methods. The Admin RPC methods manipulate state from outside a transaction (via JSON-RPC). The precompile manipulates state from inside a transaction (via Solidity call). Use the precompile when your setup needs to stay atomic, be replayable from a tx hash, or run in a loop over many slots.
Interface
Add this file to your project asIVnetPrecompile.sol:
IVnetPrecompile.sol
Functions
Storage
Balance
ERC-20 balances
The precompile locates the token’s balance storage slot automatically, so no slot input is required. Standard mapping layouts resolve directly and are cached after the first holder; non-standard layouts are discovered by probing the token’s
balanceOf execution.
Tokens that pack extra flags into the balance storage slot report
balanceOf accordingly. For example, USDC reserves the top bit of the slot, so after setMaxErc20Balance its balanceOf returns 2^255 - 1.Nonce
Events
emitEvent fires a log whose address field is target, not the calling contract. Downstream consumers (indexers, subgraphs, webhooks) treat the log as a real emission from target.
Nine overloads cover zero to four indexed topics with an optional unindexed data payload:
topic1 is typically keccak256("EventName(type,type,...)"). Example, spoof a USDC Transfer:
Cheatcode events
Every state-changing cheatcode emits a corresponding event from the precompile address (0xc100000000000000000000000000000000000000):
When inspecting a receipt for a log spoofed via
emitEvent, filter logs[] by the target address to ignore the precompile’s own entries.
Known limitations
- Base-based Virtual Environments. Solidity cheatcodes are not available on Base.
- Arbitrum-based Virtual Environments. Cheatcode calls made through
eth_calldo not work due to Arbitrum internals. Transactions, gas estimates, and simulations work as expected.
See also
- Admin RPC, the equivalent JSON-RPC methods for state manipulation from outside a transaction.
- Foundry cheatcode tutorial, end-to-end walkthrough deploying a reusable cheatcode playground.