Cheatcodes Reference
-
mock_call
- mocks a number of contract calls to an entry point -
start_mock_call
- mocks contract call to an entry point -
stop_mock_call
- cancels themock_call
/start_mock_call
for an entry point -
get_class_hash
- retrieves a class hash of a contract -
replace_bytecode
- replace the class hash of a contract -
l1_handler
- executes a#[l1_handler]
function to mock a message arriving from Ethereum -
spy_events
- createsEventSpy
instance which spies on events emitted by contracts -
spy_messages_to_l1
- createsL1MessageSpy
instance which spies on messages to L1 sent by contracts -
store
- stores values in targeted contact's storage -
load
- loads values directly from targeted contact's storage -
CheatSpan
- enum for specifying the number of target calls for a cheat
Execution Info
Caller Address
cheat_caller_address
- changes the caller address for contracts, for a number of callsstart_cheat_caller_address_global
- changes the caller address for all contractsstart_cheat_caller_address
- changes the caller address for contractsstop_cheat_caller_address
- cancels thecheat_caller_address
/start_cheat_caller_address
for contractsstop_cheat_caller_address_global
- cancels thestart_cheat_caller_address_global
Block Info
Block Number
cheat_block_number
- changes the block number for contracts, for a number of callsstart_cheat_block_number_global
- changes the block number for all contractsstart_cheat_block_number
- changes the block number for contractsstop_cheat_block_number
- cancels thecheat_block_number
/start_cheat_block_number
for contractsstop_cheat_block_number_global
- cancels thestart_cheat_block_number_global
Block Timestamp
cheat_block_timestamp
- changes the block timestamp for contracts, for a number of callsstart_cheat_block_timestamp_global
- changes the block timestamp for all contractsstart_cheat_block_timestamp
- changes the block timestamp for contractsstop_cheat_block_timestamp
- cancels thecheat_block_timestamp
/start_cheat_block_timestamp
for contractsstop_cheat_block_timestamp_global
- cancels thestart_cheat_block_timestamp_global
Sequencer Address
cheat_sequencer_address
- changes the sequencer address for contracts, for a number of callsstart_cheat_sequencer_address_global
- changes the sequencer address for all contractsstart_cheat_sequencer_address
- changes the sequencer address for contractsstop_cheat_sequencer_address
- cancels thecheat_sequencer_address
/start_cheat_sequencer_address
for contractsstop_cheat_sequencer_address_global
- cancels thestart_cheat_sequencer_address_global
Transaction Info
Transaction Version
cheat_transaction_version
- changes the transaction version for contracts, for a number of callsstart_cheat_transaction_version_global
- changes the transaction version for all contractsstart_cheat_transaction_version
- changes the transaction version for contractsstop_cheat_transaction_version
- cancels thecheat_transaction_version
/start_cheat_transaction_version
for contractsstop_cheat_transaction_version_global
- cancels thestart_cheat_transaction_version_global
Transaction Max Fee
cheat_max_fee
- changes the transaction max fee for contracts, for a number of callsstart_cheat_max_fee_global
- changes the transaction max fee for all contractsstart_cheat_max_fee
- changes the transaction max fee for contractsstop_cheat_max_fee
- cancels thecheat_max_fee
/start_cheat_max_fee
for contractsstop_cheat_max_fee_global
- cancels thestart_cheat_max_fee_global
Transaction Signature
cheat_signature
- changes the transaction signature for contracts, for a number of callsstart_cheat_signature_global
- changes the transaction signature for all contractsstart_cheat_signature
- changes the transaction signature for contractsstop_cheat_signature
- cancels thecheat_signature
/start_cheat_signature
for contractsstop_cheat_signature_global
- cancels thestart_cheat_signature_global
Transaction Hash
cheat_transaction_hash
- changes the transaction hash for contracts, for a number of callsstart_cheat_transaction_hash_global
- changes the transaction hash for all contractsstart_cheat_transaction_hash
- changes the transaction hash for contractsstop_cheat_transaction_hash
- cancels thecheat_transaction_hash
/start_cheat_transaction_hash
for contractsstop_cheat_transaction_hash_global
- cancels thestart_cheat_transaction_hash_global
Transaction Chain ID
cheat_chain_id
- changes the transaction chain_id for contracts, for a number of callsstart_cheat_chain_id_global
- changes the transaction chain_id for all contractsstart_cheat_chain_id
- changes the transaction chain_id for contractsstop_cheat_chain_id
- cancels thecheat_chain_id
/start_cheat_chain_id
for contractsstop_cheat_chain_id_global
- cancels thestart_cheat_chain_id_global
Transaction Nonce
cheat_nonce
- changes the transaction nonce for contracts, for a number of callsstart_cheat_nonce_global
- changes the transaction nonce for all contractsstart_cheat_nonce
- changes the transaction nonce for contractsstop_cheat_nonce
- cancels thecheat_nonce
/start_cheat_nonce
for contractsstop_cheat_nonce_global
- cancels thestart_cheat_nonce_global
Transaction Resource Bounds
cheat_resource_bounds
- changes the transaction resource bounds for contracts, for a number of callsstart_cheat_resource_bounds_global
- changes the transaction resource bounds for all contractsstart_cheat_resource_bounds
- changes the transaction resource bounds for contractsstop_cheat_resource_bounds
- cancels thecheat_resource_bounds
/start_cheat_resource_bounds
for contractsstop_cheat_resource_bounds_global
- cancels thestart_cheat_resource_bounds_global
Transaction Tip
cheat_tip
- changes the transaction tip for contracts, for a number of callsstart_cheat_tip_global
- changes the transaction tip for all contractsstart_cheat_tip
- changes the transaction tip for contractsstop_cheat_tip
- cancels thecheat_tip
/start_cheat_tip
for contractsstop_cheat_tip_global
- cancels thestart_cheat_tip_global
Transaction Paymaster Data
cheat_paymaster_data
- changes the transaction paymaster data for contracts, for a number of callsstart_cheat_paymaster_data_global
- changes the transaction paymaster data for all contractsstart_cheat_paymaster_data
- changes the transaction paymaster data for contractsstop_cheat_paymaster_data
- cancels thecheat_paymaster_data
/start_cheat_paymaster_data
for contractsstop_cheat_paymaster_data_global
- cancels thestart_cheat_paymaster_data_global
Transaction Nonce Data Availability Mode
cheat_nonce_data_availability_mode
- changes the transaction nonce data availability mode for contracts, for a number of callsstart_cheat_nonce_data_availability_mode_global
- changes the transaction nonce data availability mode for all contractsstart_cheat_nonce_data_availability_mode
- changes the transaction nonce data availability mode for contractsstop_cheat_nonce_data_availability_mode
- cancels thecheat_nonce_data_availability_mode
/start_cheat_nonce_data_availability_mode
for contractsstop_cheat_nonce_data_availability_mode_global
- cancels thestart_cheat_nonce_data_availability_mode_global
Transaction Fee Data Availability Mode
cheat_fee_data_availability_mode
- changes the transaction fee data availability mode for contracts, for a number of callsstart_cheat_fee_data_availability_mode_global
- changes the transaction fee data availability mode for all contractsstart_cheat_fee_data_availability_mode
- changes the transaction fee data availability mode for contractsstop_cheat_fee_data_availability_mode
- cancels thecheat_fee_data_availability_mode
/start_cheat_fee_data_availability_mode
for contractsstop_cheat_fee_data_availability_mode_global
- cancels thestart_cheat_fee_data_availability_mode_global
Transaction Account Deployment
cheat_account_deployment_data
- changes the transaction account deployment data for contracts, for a number of callsstart_cheat_account_deployment_data_global
- changes the transaction account deployment data for all contractsstart_cheat_account_deployment_data
- changes the transaction account deployment data for contractsstop_cheat_account_deployment_data
- cancels thecheat_account_deployment_data
/start_cheat_account_deployment_data
for contractsstop_cheat_account_deployment_data_global
- cancels thestart_cheat_account_deployment_data_global
Account Contract Address
cheat_account_contract_address
- changes the address of an account which the transaction originates from, for the given target and spanstart_cheat_account_contract_address_global
- changes the address of an account which the transaction originates from, for all targetsstart_cheat_account_contract_address
- changes the address of an account which the transaction originates from, for the given targetstop_cheat_account_contract_address
- cancels thecheat_account_deployment_data
/start_cheat_account_deployment_data
for the given targetstop_cheat_account_contract_address_global
- cancels thestart_cheat_account_contract_address_global
ℹ️ Info To use cheatcodes you need to add
snforge_std
package as a development dependency in yourScarb.toml
using the appropriate version.[dev-dependencies] snforge_std = "0.33.0"