EVM Cheat Codes Reference


// Print value to the debugger output window
event EvmPrint(string value);
event EvmPrint(address value);
event EvmPrint(uint256 value);

// Sets all subsequent outputs of the ADDRESS opcode to be the specified address
event EvmSpoofAddressOpcode(address addr);

// Set tx.origin
event EvmSpoofOriginOpcode(address addr);

// Sets all subsequent outputs of the CALLER opcode to be the specified address
event EvmSpoofCallerOpcode(address addr);

// Sets all subsequent calls' msg.sender to be the specified address
event EvmSpoofMsgSender(address addr);

// Resets the effects of EvmSpoof*()
event EvmUnspoof();

// Sets the value of block.timestamp
// Call "emit EvmSetBlockTimestamp(0);" to revert back to the original
event EvmSetBlockTimestamp(uint256 newTimeStamp);

// Sets the value of block.number
// Call "emit EvmSetBlockNumber(0);" to revert back to the original
event EvmSetBlockNumber(uint256 value);

// Sets the value of block.difficulty
// Call "emit EvmSetBlockDifficulty(0);" to revert back to the original
event EvmSetBlockDifficulty(uint256 value);

// Sets the value of block.chainid
// Call "emit EvmSetChainId(0);" to revert back to the original
event EvmSetChainId(uint256 value);

// Sets the ETH balance of an address
event EvmSetBalance(address addr, uint256 ethBalance);

// Programmatically enable or disable forking to an external Ethereum RPC node
event EvmSetForkUrl(string url);
event EvmSetForkBlockNumber(uint256 blockNumber);
event EvmStartFork();
event EvmStopFork();