Keyboard shortcuts

Press or to navigate between chapters

Press ? to show this help

Press Esc to hide this help

snforge_std

[source code]

Fully qualified path: snforge_std

Modules


Re-exports:

cheat_block_hashChanges the block hash for the given block number and contract address….
start_cheat_block_hashStarts a block hash modification for a specific contract….
start_cheat_block_hash_globalStarts a global block hash modification….
stop_cheat_block_hashCancels the cheat_block_hash / start_cheat_block_hash for a specific contract….
stop_cheat_block_hash_globalCancels the start_cheat_block_hash_global ….
declareDeclares a contract contract - name of a contract as Cairo string. It is a name of the contract (part after mod keyword) e.g. “HelloStarknet” Returns the DeclareResult
get_class_hashRetrieves a class hash of a contract deployed under the given address contract_address - target contract address Returns the ClassHash under given address
set_balanceSets the balance of token`` for target `` contract to new_balance
spy_eventsCreates EventSpy instance that spies on all events emitted after its creation.
cheat_account_contract_addressChanges the address of an account which the transaction originates from, for the given contract address and span….
start_cheat_account_contract_addressChanges the address of an account which the transaction originates from, for the given contract_address….
start_cheat_account_contract_address_globalChanges the address of an account which the transaction originates from….
stop_cheat_account_contract_addressCancels the cheat_account_contract_address / start_cheat_account_contract_address for the given contract_address….
stop_cheat_account_contract_address_globalCancels the start_cheat_account_contract_address_global .
cheat_account_deployment_dataChanges the transaction account deployment data for the given contract address and span….
start_cheat_account_deployment_dataChanges the transaction account deployment data for the given contract_address….
start_cheat_account_deployment_data_globalChanges the transaction account deployment data….
stop_cheat_account_deployment_dataCancels the cheat_account_deployment_data / start_cheat_account_deployment_data for the given contract_address….
stop_cheat_account_deployment_data_globalCancels the cheat_account_deployment_data_global .
cheat_block_numberChanges the block number for the given contract address and span….
start_cheat_block_numberChanges the block number for the given contract_address….
start_cheat_block_number_globalChanges the block number….
stop_cheat_block_numberCancels the cheat_block_number / start_cheat_block_number for the given contract_address….
stop_cheat_block_number_globalCancels the start_cheat_block_number_global .
cheat_block_timestampChanges the block timestamp for the given contract address and span….
start_cheat_block_timestampChanges the block timestamp for the given contract_address….
start_cheat_block_timestamp_globalChanges the block timestamp….
stop_cheat_block_timestampCancels the cheat_block_timestamp / start_cheat_block_timestamp for the given contract_address….
stop_cheat_block_timestamp_globalCancels the start_cheat_block_timestamp_global .
cheat_caller_addressChanges the caller address for the given contract address and span….
start_cheat_caller_addressChanges the caller address for the given contract_address….
start_cheat_caller_address_globalChanges the caller address….
stop_cheat_caller_addressCancels the cheat_caller_address / start_cheat_caller_address for the given contract_address….
stop_cheat_caller_address_globalCancels the start_cheat_caller_address_global .
cheat_chain_idChanges the transaction chain_id for the given contract address and span….
start_cheat_chain_idChanges the transaction chain_id for the given contract_address….
start_cheat_chain_id_globalChanges the transaction chain_id….
stop_cheat_chain_idCancels the cheat_chain_id / start_cheat_chain_id for the given contract_address….
stop_cheat_chain_id_globalCancels the start_cheat_chain_id_global .
cheat_fee_data_availability_modeChanges the transaction fee data availability mode for the given contract address and span….
start_cheat_fee_data_availability_modeChanges the transaction fee data availability mode for the given contract_address….
start_cheat_fee_data_availability_mode_globalChanges the transaction fee data availability mode….
stop_cheat_fee_data_availability_modeCancels the cheat_fee_data_availability_mode / start_cheat_fee_data_availability_mode for the given contract_address….
stop_cheat_fee_data_availability_mode_globalCancels the start_cheat_fee_data_availability_mode_global .
cheat_max_feeChanges the transaction max fee for the given contract address and span….
start_cheat_max_feeChanges the transaction max fee for the given contract_address….
start_cheat_max_fee_globalChanges the transaction max fee….
stop_cheat_max_feeCancels the cheat_max_fee / start_cheat_max_fee for the given contract_address….
stop_cheat_max_fee_globalCancels the start_cheat_max_fee_global .
cheat_nonceChanges the transaction nonce for the given contract address and span….
start_cheat_nonceChanges the transaction nonce for the given contract_address….
start_cheat_nonce_globalChanges the transaction nonce….
stop_cheat_nonceCancels the cheat_nonce / start_cheat_nonce for the given contract_address….
stop_cheat_nonce_globalCancels the start_cheat_nonce_global .
cheat_nonce_data_availability_modeChanges the transaction nonce data availability mode for the given contract address and span….
start_cheat_nonce_data_availability_modeChanges the transaction nonce data availability mode for the given contract_address….
start_cheat_nonce_data_availability_mode_globalChanges the transaction nonce data availability mode….
stop_cheat_nonce_data_availability_modeCancels the cheat_nonce_data_availability_mode / start_cheat_nonce_data_availability_mode for the given contract_address….
stop_cheat_nonce_data_availability_mode_globalCancels the start_cheat_nonce_data_availability_mode_global .
cheat_paymaster_dataChanges the transaction paymaster data for the given contract address and span….
start_cheat_paymaster_dataChanges the transaction paymaster data for the given contract_address….
start_cheat_paymaster_data_globalChanges the transaction paymaster data….
stop_cheat_paymaster_dataCancels the cheat_paymaster_data / start_cheat_paymaster_data for the given contract_address….
stop_cheat_paymaster_data_globalCancels the start_cheat_paymaster_data_global .
cheat_resource_boundsChanges the transaction resource bounds for the given contract address and span….
start_cheat_resource_boundsChanges the transaction resource bounds for the given contract_address….
start_cheat_resource_bounds_globalChanges the transaction resource bounds….
stop_cheat_resource_boundsCancels the cheat_resource_bounds / start_cheat_resource_bounds for the given contract_address….
stop_cheat_resource_bounds_globalCancels the start_cheat_resource_bounds_global .
cheat_sequencer_addressChanges the sequencer address for the given contract address and span….
start_cheat_sequencer_addressChanges the sequencer address for the given contract_address….
start_cheat_sequencer_address_globalChanges the sequencer address….
stop_cheat_sequencer_addressCancels the cheat_sequencer_address / start_cheat_sequencer_address for the given contract_address….
stop_cheat_sequencer_address_globalCancels the start_cheat_sequencer_address_global .
cheat_signatureChanges the transaction signature for the given contract address and span….
start_cheat_signatureChanges the transaction signature for the given contract_address….
start_cheat_signature_globalChanges the transaction signature….
stop_cheat_signatureCancels the cheat_signature / start_cheat_signature for the given contract_address….
stop_cheat_signature_globalCancels the start_cheat_signature_global .
cheat_tipChanges the transaction tip for the given contract address and span….
start_cheat_tipChanges the transaction tip for the given contract_address….
start_cheat_tip_globalChanges the transaction tip….
stop_cheat_tipCancels the cheat_tip / start_cheat_tip for the given contract_address….
stop_cheat_tip_globalCancels the start_cheat_tip_global .
cheat_transaction_hashChanges the transaction hash for the given contract address and span….
start_cheat_transaction_hashChanges the transaction hash for the given contract_address….
start_cheat_transaction_hash_globalChanges the transaction hash….
stop_cheat_transaction_hashCancels the cheat_transaction_hash / start_cheat_transaction_hash for the given contract_address….
stop_cheat_transaction_hash_globalCancels the start_cheat_transaction_hash_global .
cheat_transaction_versionChanges the transaction version for the given contract address and span….
start_cheat_transaction_versionChanges the transaction version for the given contract_address….
start_cheat_transaction_version_globalChanges the transaction version….
stop_cheat_transaction_versionCancels the cheat_transaction_version / start_cheat_transaction_version for the given contract_address….
stop_cheat_transaction_version_globalCancels the start_cheat_transaction_version_global .
generate_random_feltGenerates a random felt value Returns a random felt within the range of 0 and 2^252 - 1
spy_messages_to_l1Creates MessageToL1Spy instance that spies on all messages sent to L1
storeStores felts from serialized_value in target contract’s storage, starting at storage_address ….
interact_with_state
loadLoads size felts from target contract’s storage into an Array , starting at storage_address ….
map_entry_address
mock_callMocks contract call to a function_selector of a contract at the given address, for n_times first calls that are made to the contract. A call to function function_selector
replace_bytecodeReplaces class for given contract address. The new_class hash has to be declared in order for the replacement class to execute the code, when interacting with the contract….
start_mock_callMocks contract call to a function of a contract at the given address, indefinitely. See mock_call for comprehensive definition of how it can be used….
stop_mock_callCancels the mock_call / start_mock_call for the function with given name and contract address….
test_address
test_selector

ContractClass
CustomToken
EventRaw event format (as seen via the RPC-API), can be used for asserting the emitted events.
EventSpyAn event spy structure allowing to get events emitted only after its creation.
L1Handler
MessageToL1Raw message to L1 format (as seen via the RPC-API), can be used for asserting the sent messages.
MessageToL1SpyA message spy structure allowing to get messages emitted only after its creation.

CheatSpanEnum used to specify how long the target should be cheated for.
DeclareResult
Token
ReplaceBytecodeError

ContractClassTrait
DeclareResultTrait
TokenTrait
EventSpyAssertionsTraitAllows to assert the expected events emission (or lack thereof), in the scope of EventSpy structure.
EventSpyTrait
EventsFilterTrait
IsEmitted
L1HandlerTrait
MessageToL1FilterTrait
MessageToL1SpyAssertionsTraitAllows to assert the expected sent messages (or lack thereof), in the scope of MessageToL1Spy structure.
MessageToL1SpyTrait


Modules

Modules

cheatcodes

[source code]

Fully qualified path: snforge_std::cheatcodes

Modules

Free functions

test_selector
test_address
mock_callMocks contract call to a function_selector of a contract at the given address, for n_times first calls that are made to the contract. A call to function function_selector
start_mock_callMocks contract call to a function of a contract at the given address, indefinitely. See mock_call for comprehensive definition of how it can be used….
stop_mock_callCancels the mock_call / start_mock_call for the function with given name and contract address….
replace_bytecodeReplaces class for given contract address. The new_class hash has to be declared in order for the replacement class to execute the code, when interacting with the contract….

Enums

CheatSpanEnum used to specify how long the target should be cheated for.
ReplaceBytecodeError

Modules

Modules

block_hash

[source code]

Fully qualified path: snforge_std::cheatcodes::block_hash

Free functions

cheat_block_hashChanges the block hash for the given block number and contract address….
start_cheat_block_hash_globalStarts a global block hash modification….
stop_cheat_block_hash_globalCancels the start_cheat_block_hash_global ….
start_cheat_block_hashStarts a block hash modification for a specific contract….
stop_cheat_block_hashCancels the cheat_block_hash / start_cheat_block_hash for a specific contract….

Free functions

Free functions

cheat_block_hashChanges the block hash for the given block number and contract address….
start_cheat_block_hash_globalStarts a global block hash modification….
stop_cheat_block_hash_globalCancels the start_cheat_block_hash_global ….
start_cheat_block_hashStarts a block hash modification for a specific contract….
stop_cheat_block_hashCancels the cheat_block_hash / start_cheat_block_hash for a specific contract….

cheat_block_hash

[source code]

Changes the block hash for the given block number and contract address.

  • contract_address - The contract address to which the cheat applies.
  • block_number - Block number to be modified.
  • block_hash - felt252 representing the new block hash.
  • span - instance of CheatSpan specifying the number of syscalls with the cheat

Fully qualified path: snforge_std::cheatcodes::block_hash::cheat_block_hash

pub fn cheat_block_hash(
    contract_address: ContractAddress, block_number: u64, block_hash: felt252, span: CheatSpan,
)

start_cheat_block_hash_global

[source code]

Starts a global block hash modification.

  • block_number - Block number to be modified.
  • block_hash - The block hash value to set globally.

Fully qualified path: snforge_std::cheatcodes::block_hash::start_cheat_block_hash_global

pub fn start_cheat_block_hash_global(block_number: u64, block_hash: felt252)

stop_cheat_block_hash_global

[source code]

Cancels the start_cheat_block_hash_global.

  • block_number - Block number for which the cheat should be stopped.

Fully qualified path: snforge_std::cheatcodes::block_hash::stop_cheat_block_hash_global

pub fn stop_cheat_block_hash_global(block_number: u64)

start_cheat_block_hash

[source code]

Starts a block hash modification for a specific contract.

  • contract_address - Contract address associated with the modification.
  • block_number - Block number to be modified.
  • block_hash - The block hash to set.

Fully qualified path: snforge_std::cheatcodes::block_hash::start_cheat_block_hash

pub fn start_cheat_block_hash(
    contract_address: ContractAddress, block_number: u64, block_hash: felt252,
)

stop_cheat_block_hash

[source code]

Cancels the cheat_block_hash/start_cheat_block_hash for a specific contract.

  • block_number - Block number for which the cheat should be stopped.
  • contract_address - The contract affected by the previous cheat.

Fully qualified path: snforge_std::cheatcodes::block_hash::stop_cheat_block_hash

pub fn stop_cheat_block_hash(contract_address: ContractAddress, block_number: u64)

contract_class

[source code]

Fully qualified path: snforge_std::cheatcodes::contract_class

Free functions

declareDeclares a contract contract - name of a contract as Cairo string. It is a name of the contract (part after mod keyword) e.g. “HelloStarknet” Returns the DeclareResult
get_class_hashRetrieves a class hash of a contract deployed under the given address contract_address - target contract address Returns the ClassHash under given address

Structs

Enums

Traits

Free functions

Free functions

declareDeclares a contract contract - name of a contract as Cairo string. It is a name of the contract (part after mod keyword) e.g. “HelloStarknet” Returns the DeclareResult
get_class_hashRetrieves a class hash of a contract deployed under the given address contract_address - target contract address Returns the ClassHash under given address

declare

[source code]

Declares a contract contract - name of a contract as Cairo string. It is a name of the contract (part after mod keyword) e.g. “HelloStarknet” Returns the DeclareResult that encapsulated possible outcomes in the enum:

  • Success: Contains the successfully declared ContractClass.
  • AlreadyDeclared: Contains ContractClass and signals that the contract has already been declared.

Fully qualified path: snforge_std::cheatcodes::contract_class::declare

pub fn declare(contract: ByteArray) -> Result<DeclareResult, Array<felt252>>

get_class_hash

[source code]

Retrieves a class hash of a contract deployed under the given address contract_address - target contract address Returns the ClassHash under given address

Fully qualified path: snforge_std::cheatcodes::contract_class::get_class_hash

pub fn get_class_hash(contract_address: ContractAddress) -> ClassHash

Structs

Structs

ContractClass

[source code]

Fully qualified path: snforge_std::cheatcodes::contract_class::ContractClass

[derive(Drop, Serde, Copy)]
pub struct ContractClass {
    pub class_hash: ClassHash,
}

Members

class_hash

Fully qualified path: snforge_std::cheatcodes::contract_class::ContractClass::class_hash

pub class_hash: ClassHash

Enums

Enums

DeclareResult

[source code]

Fully qualified path: snforge_std::cheatcodes::contract_class::DeclareResult

pub enum DeclareResult {
    Success: ContractClass,
    AlreadyDeclared: ContractClass,
}

Variants

Success

Fully qualified path: snforge_std::cheatcodes::contract_class::DeclareResult::Success

Success: ContractClass

AlreadyDeclared

Fully qualified path: snforge_std::cheatcodes::contract_class::DeclareResult::AlreadyDeclared

AlreadyDeclared: ContractClass

Traits

Traits

ContractClassTrait

[source code]

Fully qualified path: snforge_std::cheatcodes::contract_class::ContractClassTrait

pub trait ContractClassTrait

Trait functions

precalculate_address

Calculates an address of a contract in advance that would be returned when calling deploy The precalculated address is only correct for the very next deployment The constructor_calldata has a direct impact on the resulting contract address self - an instance of the struct ContractClass which is obtained by calling declare and unpacking DeclareResult constructor_calldata - serialized calldata for the deploy constructor Returns the precalculated ContractAddress

Fully qualified path: snforge_std::cheatcodes::contract_class::ContractClassTrait::precalculate_address

fn precalculate_address(
    self: ContractClass, constructor_calldata: Array<felt252>,
) -> ContractAddress

deploy

Deploys a contract self - an instance of the struct ContractClass which is obtained by calling declare and unpacking DeclareResult constructor_calldata - calldata for the constructor, serialized with Serde Returns the address the contract was deployed at and serialized constructor return data, or panic data if it failed

Fully qualified path: snforge_std::cheatcodes::contract_class::ContractClassTrait::deploy

fn deploy(
    self: ContractClass, constructor_calldata: Array<felt252>,
) -> Result<(ContractAddress, Span<felt252>), Array<felt252>>

deploy_at

Deploys a contract at a given address self - an instance of the struct ContractClass which is obtained by calling declare and unpacking DeclareResult constructor_calldata - serialized calldata for the constructor contract_address - address the contract should be deployed at Returns the address the contract was deployed at and serialized constructor return data, or panic data if it failed

Fully qualified path: snforge_std::cheatcodes::contract_class::ContractClassTrait::deploy_at

fn deploy_at(
    self: ContractClass, constructor_calldata: Array<felt252>, contract_address: ContractAddress,
) -> Result<(ContractAddress, Span<felt252>), Array<felt252>>

new

Utility method for creating a new ContractClass instance class_hash - a numeric value that can be converted into the class hash of ContractClass Returns the created ContractClass

Fully qualified path: snforge_std::cheatcodes::contract_class::ContractClassTrait::new

fn new<T, +Into<T, ClassHash>>(class_hash: T) -> ContractClass

DeclareResultTrait

[source code]

Fully qualified path: snforge_std::cheatcodes::contract_class::DeclareResultTrait

pub trait DeclareResultTrait

Trait functions

contract_class

Gets inner ContractClass self - an instance of the struct DeclareResult which is obtained by calling declare

Fully qualified path: snforge_std::cheatcodes::contract_class::DeclareResultTrait::contract_class

fn contract_class(self: DeclareResult) -> ContractClass

erc20

[source code]

Fully qualified path: snforge_std::cheatcodes::erc20

Free functions

set_balanceSets the balance of token`` for target `` contract to new_balance

Structs

Enums

Token

Traits

Impls

Free functions

Free functions

set_balanceSets the balance of token`` for target `` contract to new_balance

set_balance

[source code]

Sets the balance of token`` for target`` contract to new_balance

  • target - address of the contract, which balance you want to modify
  • new_balance - new balance value
  • token - token for which the balance is being set

Fully qualified path: snforge_std::cheatcodes::erc20::set_balance

pub fn set_balance(target: ContractAddress, new_balance: u256, token: Token)

Structs

Structs

CustomToken

[source code]

Fully qualified path: snforge_std::cheatcodes::erc20::CustomToken

[derive(Drop, Serde, Copy, Debug)]
pub struct CustomToken {
    pub contract_address: ContractAddress,
    pub balances_variable_selector: felt252,
}

Members

contract_address

Fully qualified path: snforge_std::cheatcodes::erc20::CustomToken::contract_address

pub contract_address: ContractAddress

balances_variable_selector

Fully qualified path: snforge_std::cheatcodes::erc20::CustomToken::balances_variable_selector

pub balances_variable_selector: felt252

Enums

Enums

Token

Token

[source code]

Fully qualified path: snforge_std::cheatcodes::erc20::Token

pub enum Token {
    STRK,
    ETH,
    Custom: CustomToken,
}

Variants

STRK

Fully qualified path: snforge_std::cheatcodes::erc20::Token::STRK

STRK

ETH

Fully qualified path: snforge_std::cheatcodes::erc20::Token::ETH

ETH

Custom

Fully qualified path: snforge_std::cheatcodes::erc20::Token::Custom

Custom: CustomToken

Traits

Traits

TokenTrait

[source code]

Fully qualified path: snforge_std::cheatcodes::erc20::TokenTrait

pub trait TokenTrait

Trait functions

contract_address

Fully qualified path: snforge_std::cheatcodes::erc20::TokenTrait::contract_address

fn contract_address(self: Token) -> ContractAddress

balances_variable_selector

Fully qualified path: snforge_std::cheatcodes::erc20::TokenTrait::balances_variable_selector

fn balances_variable_selector(self: Token) -> felt252

Impls

Impls

TokenImpl

[source code]

Fully qualified path: snforge_std::cheatcodes::erc20::TokenImpl

pub impl TokenImpl of TokenTrait;

Impl functions

contract_address

Fully qualified path: snforge_std::cheatcodes::erc20::TokenImpl::contract_address

fn contract_address(self: Token) -> ContractAddress

balances_variable_selector

Fully qualified path: snforge_std::cheatcodes::erc20::TokenImpl::balances_variable_selector

fn balances_variable_selector(self: Token) -> felt252

events

[source code]

Fully qualified path: snforge_std::cheatcodes::events

Free functions

spy_eventsCreates EventSpy instance that spies on all events emitted after its creation.

Structs

EventRaw event format (as seen via the RPC-API), can be used for asserting the emitted events.
EventSpyAn event spy structure allowing to get events emitted only after its creation.
EventsA wrapper structure on an array of events to handle filtering smoothly.

Traits

EventSpyTrait
EventsFilterTrait
EventSpyAssertionsTraitAllows to assert the expected events emission (or lack thereof), in the scope of EventSpy structure.
IsEmitted

Free functions

Free functions

spy_eventsCreates EventSpy instance that spies on all events emitted after its creation.

spy_events

[source code]

Creates EventSpy instance that spies on all events emitted after its creation.

Fully qualified path: snforge_std::cheatcodes::events::spy_events

pub fn spy_events() -> EventSpy

Structs

Structs

EventRaw event format (as seen via the RPC-API), can be used for asserting the emitted events.
EventSpyAn event spy structure allowing to get events emitted only after its creation.
EventsA wrapper structure on an array of events to handle filtering smoothly.

Event

[source code]

Raw event format (as seen via the RPC-API), can be used for asserting the emitted events.

Fully qualified path: snforge_std::cheatcodes::events::Event

[derive(Drop, Clone, Serde, Debug, PartialEq)]
pub struct Event {
    pub keys: Array<felt252>,
    pub data: Array<felt252>,
}

Members

keys

Fully qualified path: snforge_std::cheatcodes::events::Event::keys

pub keys: Array<felt252>

data

Fully qualified path: snforge_std::cheatcodes::events::Event::data

pub data: Array<felt252>

EventSpy

[source code]

An event spy structure allowing to get events emitted only after its creation.

Fully qualified path: snforge_std::cheatcodes::events::EventSpy

[derive(Drop, Serde)]
pub struct EventSpy { /* private fields */ }

Events

[source code]

A wrapper structure on an array of events to handle filtering smoothly.

Fully qualified path: snforge_std::cheatcodes::events::Events

[derive(Drop, Serde, Clone, Debug, PartialEq)]
pub struct Events {
    pub events: Array<(ContractAddress, Event)>,
}

Members

events

Fully qualified path: snforge_std::cheatcodes::events::Events::events

pub events: Array<(ContractAddress, Event)>

Traits

Traits

EventSpyTrait
EventsFilterTrait
EventSpyAssertionsTraitAllows to assert the expected events emission (or lack thereof), in the scope of EventSpy structure.
IsEmitted

EventSpyTrait

[source code]

Fully qualified path: snforge_std::cheatcodes::events::EventSpyTrait

pub trait EventSpyTrait

Trait functions

get_events

Gets all events given EventSpy spies for.

Fully qualified path: snforge_std::cheatcodes::events::EventSpyTrait::get_events

fn get_events(ref self: EventSpy) -> Events

EventsFilterTrait

[source code]

Fully qualified path: snforge_std::cheatcodes::events::EventsFilterTrait

pub trait EventsFilterTrait

Trait functions

emitted_by

Filter events emitted by a given ContractAddress.

Fully qualified path: snforge_std::cheatcodes::events::EventsFilterTrait::emitted_by

fn emitted_by(self: Events, contract_address: ContractAddress) -> Events

EventSpyAssertionsTrait

[source code]

Allows to assert the expected events emission (or lack thereof), in the scope of EventSpy structure.

Fully qualified path: snforge_std::cheatcodes::events::EventSpyAssertionsTrait

pub trait EventSpyAssertionsTrait<T, impl Event<T>: Event<T>+Drop<T>>

Trait functions

assert_emitted

Fully qualified path: snforge_std::cheatcodes::events::EventSpyAssertionsTrait::assert_emitted

fn assert_emitted(ref self: EventSpy, events: @Array<(ContractAddress, T)>)

assert_not_emitted

Fully qualified path: snforge_std::cheatcodes::events::EventSpyAssertionsTrait::assert_not_emitted

fn assert_not_emitted(ref self: EventSpy, events: @Array<(ContractAddress, T)>)

IsEmitted

[source code]

Fully qualified path: snforge_std::cheatcodes::events::IsEmitted

pub trait IsEmitted<T, impl Event<T>: Event<T>+Drop<T>>

Trait functions

is_emitted

Fully qualified path: snforge_std::cheatcodes::events::IsEmitted::is_emitted

fn is_emitted(self: Events, expected_emitted_by: ContractAddress, expected_event: @T) -> bool

execution_info

[source code]

Fully qualified path: snforge_std::cheatcodes::execution_info

Modules

Modules

Modules

account_contract_address

[source code]

Fully qualified path: snforge_std::cheatcodes::execution_info::account_contract_address

Free functions

cheat_account_contract_addressChanges the address of an account which the transaction originates from, for the given contract address and span….
start_cheat_account_contract_address_globalChanges the address of an account which the transaction originates from….
stop_cheat_account_contract_address_globalCancels the start_cheat_account_contract_address_global .
start_cheat_account_contract_addressChanges the address of an account which the transaction originates from, for the given contract_address….
stop_cheat_account_contract_addressCancels the cheat_account_contract_address / start_cheat_account_contract_address for the given contract_address….

Free functions

Free functions

cheat_account_contract_addressChanges the address of an account which the transaction originates from, for the given contract address and span….
start_cheat_account_contract_address_globalChanges the address of an account which the transaction originates from….
stop_cheat_account_contract_address_globalCancels the start_cheat_account_contract_address_global .
start_cheat_account_contract_addressChanges the address of an account which the transaction originates from, for the given contract_address….
stop_cheat_account_contract_addressCancels the cheat_account_contract_address / start_cheat_account_contract_address for the given contract_address….

cheat_account_contract_address

[source code]

Changes the address of an account which the transaction originates from, for the given contract address and span.

  • contract_address - instance of ContractAddress specifying which contracts to cheat
  • account_contract_address - transaction account deployment data to be set
  • span - instance of CheatSpan specifying the number of contract calls with the cheat applied

Fully qualified path: snforge_std::cheatcodes::execution_info::account_contract_address::cheat_account_contract_address

pub fn cheat_account_contract_address(
    contract_address: ContractAddress, account_contract_address: ContractAddress, span: CheatSpan,
)

start_cheat_account_contract_address_global

[source code]

Changes the address of an account which the transaction originates from.

  • account_contract_address - transaction account deployment data to be set

Fully qualified path: snforge_std::cheatcodes::execution_info::account_contract_address::start_cheat_account_contract_address_global

pub fn start_cheat_account_contract_address_global(account_contract_address: ContractAddress)

stop_cheat_account_contract_address_global

[source code]

Cancels the start_cheat_account_contract_address_global.

Fully qualified path: snforge_std::cheatcodes::execution_info::account_contract_address::stop_cheat_account_contract_address_global

pub fn stop_cheat_account_contract_address_global()

start_cheat_account_contract_address

[source code]

Changes the address of an account which the transaction originates from, for the given contract_address.

  • contract_address - instance of ContractAddress specifying which contract to cheat
  • account_contract_address - transaction account deployment data to be set

Fully qualified path: snforge_std::cheatcodes::execution_info::account_contract_address::start_cheat_account_contract_address

pub fn start_cheat_account_contract_address(
    contract_address: ContractAddress, account_contract_address: ContractAddress,
)

stop_cheat_account_contract_address

[source code]

Cancels the cheat_account_contract_address / start_cheat_account_contract_address for the given contract_address.

  • contract_address - instance of ContractAddress specifying which contract to stop cheating

Fully qualified path: snforge_std::cheatcodes::execution_info::account_contract_address::stop_cheat_account_contract_address

pub fn stop_cheat_account_contract_address(contract_address: ContractAddress)

account_deployment_data

[source code]

Fully qualified path: snforge_std::cheatcodes::execution_info::account_deployment_data

Free functions

cheat_account_deployment_dataChanges the transaction account deployment data for the given contract address and span….
start_cheat_account_deployment_data_globalChanges the transaction account deployment data….
stop_cheat_account_deployment_data_globalCancels the cheat_account_deployment_data_global .
start_cheat_account_deployment_dataChanges the transaction account deployment data for the given contract_address….
stop_cheat_account_deployment_dataCancels the cheat_account_deployment_data / start_cheat_account_deployment_data for the given contract_address….

Free functions

Free functions

cheat_account_deployment_dataChanges the transaction account deployment data for the given contract address and span….
start_cheat_account_deployment_data_globalChanges the transaction account deployment data….
stop_cheat_account_deployment_data_globalCancels the cheat_account_deployment_data_global .
start_cheat_account_deployment_dataChanges the transaction account deployment data for the given contract_address….
stop_cheat_account_deployment_dataCancels the cheat_account_deployment_data / start_cheat_account_deployment_data for the given contract_address….

cheat_account_deployment_data

[source code]

Changes the transaction account deployment data for the given contract address and span.

  • contract_address - instance of ContractAddress specifying which contracts to cheat
  • account_deployment_data - transaction account deployment data to be set
  • span - instance of CheatSpan specifying the number of contract calls with the cheat applied

Fully qualified path: snforge_std::cheatcodes::execution_info::account_deployment_data::cheat_account_deployment_data

pub fn cheat_account_deployment_data(
    contract_address: ContractAddress, account_deployment_data: Span<felt252>, span: CheatSpan,
)

start_cheat_account_deployment_data_global

[source code]

Changes the transaction account deployment data.

  • account_deployment_data - transaction account deployment data to be set

Fully qualified path: snforge_std::cheatcodes::execution_info::account_deployment_data::start_cheat_account_deployment_data_global

pub fn start_cheat_account_deployment_data_global(account_deployment_data: Span<felt252>)

stop_cheat_account_deployment_data_global

[source code]

Cancels the cheat_account_deployment_data_global.

Fully qualified path: snforge_std::cheatcodes::execution_info::account_deployment_data::stop_cheat_account_deployment_data_global

pub fn stop_cheat_account_deployment_data_global()

start_cheat_account_deployment_data

[source code]

Changes the transaction account deployment data for the given contract_address.

  • contract_address - instance of ContractAddress specifying which contract to cheat
  • account_deployment_data - transaction account deployment data to be set

Fully qualified path: snforge_std::cheatcodes::execution_info::account_deployment_data::start_cheat_account_deployment_data

pub fn start_cheat_account_deployment_data(
    contract_address: ContractAddress, account_deployment_data: Span<felt252>,
)

stop_cheat_account_deployment_data

[source code]

Cancels the cheat_account_deployment_data / start_cheat_account_deployment_data for the given contract_address.

  • contract_address - instance of ContractAddress specifying which contract to stop cheating

Fully qualified path: snforge_std::cheatcodes::execution_info::account_deployment_data::stop_cheat_account_deployment_data

pub fn stop_cheat_account_deployment_data(contract_address: ContractAddress)

block_number

[source code]

Fully qualified path: snforge_std::cheatcodes::execution_info::block_number

Free functions

cheat_block_numberChanges the block number for the given contract address and span….
start_cheat_block_number_globalChanges the block number….
stop_cheat_block_number_globalCancels the start_cheat_block_number_global .
start_cheat_block_numberChanges the block number for the given contract_address….
stop_cheat_block_numberCancels the cheat_block_number / start_cheat_block_number for the given contract_address….

Free functions

Free functions

cheat_block_numberChanges the block number for the given contract address and span….
start_cheat_block_number_globalChanges the block number….
stop_cheat_block_number_globalCancels the start_cheat_block_number_global .
start_cheat_block_numberChanges the block number for the given contract_address….
stop_cheat_block_numberCancels the cheat_block_number / start_cheat_block_number for the given contract_address….

cheat_block_number

[source code]

Changes the block number for the given contract address and span.

  • contract_address - instance of ContractAddress specifying which contract to cheat
  • block_number - block number to be set
  • span - instance of CheatSpan specifying the number of contract calls with the cheat applied

Fully qualified path: snforge_std::cheatcodes::execution_info::block_number::cheat_block_number

pub fn cheat_block_number(contract_address: ContractAddress, block_number: u64, span: CheatSpan)

start_cheat_block_number_global

[source code]

Changes the block number.

  • block_number - block number to be set

Fully qualified path: snforge_std::cheatcodes::execution_info::block_number::start_cheat_block_number_global

pub fn start_cheat_block_number_global(block_number: u64)

stop_cheat_block_number_global

[source code]

Cancels the start_cheat_block_number_global.

Fully qualified path: snforge_std::cheatcodes::execution_info::block_number::stop_cheat_block_number_global

pub fn stop_cheat_block_number_global()

start_cheat_block_number

[source code]

Changes the block number for the given contract_address.

  • contract_address - instance of ContractAddress specifying which contract to cheat
  • block_number - block number to be set

Fully qualified path: snforge_std::cheatcodes::execution_info::block_number::start_cheat_block_number

pub fn start_cheat_block_number(contract_address: ContractAddress, block_number: u64)

stop_cheat_block_number

[source code]

Cancels the cheat_block_number / start_cheat_block_number for the given contract_address.

  • contract_address - instance of ContractAddress specifying which contract to stop cheating

Fully qualified path: snforge_std::cheatcodes::execution_info::block_number::stop_cheat_block_number

pub fn stop_cheat_block_number(contract_address: ContractAddress)

block_timestamp

[source code]

Fully qualified path: snforge_std::cheatcodes::execution_info::block_timestamp

Free functions

cheat_block_timestampChanges the block timestamp for the given contract address and span….
start_cheat_block_timestamp_globalChanges the block timestamp….
stop_cheat_block_timestamp_globalCancels the start_cheat_block_timestamp_global .
start_cheat_block_timestampChanges the block timestamp for the given contract_address….
stop_cheat_block_timestampCancels the cheat_block_timestamp / start_cheat_block_timestamp for the given contract_address….

Free functions

Free functions

cheat_block_timestampChanges the block timestamp for the given contract address and span….
start_cheat_block_timestamp_globalChanges the block timestamp….
stop_cheat_block_timestamp_globalCancels the start_cheat_block_timestamp_global .
start_cheat_block_timestampChanges the block timestamp for the given contract_address….
stop_cheat_block_timestampCancels the cheat_block_timestamp / start_cheat_block_timestamp for the given contract_address….

cheat_block_timestamp

[source code]

Changes the block timestamp for the given contract address and span.

  • contract_address - instance of ContractAddress specifying which contract to cheat
  • block_timestamp - block timestamp to be set
  • span - instance of CheatSpan specifying the number of contract calls with the cheat applied

Fully qualified path: snforge_std::cheatcodes::execution_info::block_timestamp::cheat_block_timestamp

pub fn cheat_block_timestamp(
    contract_address: ContractAddress, block_timestamp: u64, span: CheatSpan,
)

start_cheat_block_timestamp_global

[source code]

Changes the block timestamp.

  • block_timestamp - block timestamp to be set

Fully qualified path: snforge_std::cheatcodes::execution_info::block_timestamp::start_cheat_block_timestamp_global

pub fn start_cheat_block_timestamp_global(block_timestamp: u64)

stop_cheat_block_timestamp_global

[source code]

Cancels the start_cheat_block_timestamp_global.

Fully qualified path: snforge_std::cheatcodes::execution_info::block_timestamp::stop_cheat_block_timestamp_global

pub fn stop_cheat_block_timestamp_global()

start_cheat_block_timestamp

[source code]

Changes the block timestamp for the given contract_address.

  • contract_address - instance of ContractAddress specifying which contract to cheat
  • block_timestamp - block timestamp to be set

Fully qualified path: snforge_std::cheatcodes::execution_info::block_timestamp::start_cheat_block_timestamp

pub fn start_cheat_block_timestamp(contract_address: ContractAddress, block_timestamp: u64)

stop_cheat_block_timestamp

[source code]

Cancels the cheat_block_timestamp / start_cheat_block_timestamp for the given contract_address.

  • contract_address - instance of ContractAddress specifying which contract to stop cheating

Fully qualified path: snforge_std::cheatcodes::execution_info::block_timestamp::stop_cheat_block_timestamp

pub fn stop_cheat_block_timestamp(contract_address: ContractAddress)

caller_address

[source code]

Fully qualified path: snforge_std::cheatcodes::execution_info::caller_address

Free functions

cheat_caller_addressChanges the caller address for the given contract address and span….
start_cheat_caller_address_globalChanges the caller address….
stop_cheat_caller_address_globalCancels the start_cheat_caller_address_global .
start_cheat_caller_addressChanges the caller address for the given contract_address….
stop_cheat_caller_addressCancels the cheat_caller_address / start_cheat_caller_address for the given contract_address….

Free functions

Free functions

cheat_caller_addressChanges the caller address for the given contract address and span….
start_cheat_caller_address_globalChanges the caller address….
stop_cheat_caller_address_globalCancels the start_cheat_caller_address_global .
start_cheat_caller_addressChanges the caller address for the given contract_address….
stop_cheat_caller_addressCancels the cheat_caller_address / start_cheat_caller_address for the given contract_address….

cheat_caller_address

[source code]

Changes the caller address for the given contract address and span.

  • contract_address - instance of ContractAddress specifying which contract to cheat
  • caller_address - caller address to be set
  • span - instance of CheatSpan specifying the number of contract calls with the cheat applied

Fully qualified path: snforge_std::cheatcodes::execution_info::caller_address::cheat_caller_address

pub fn cheat_caller_address(
    contract_address: ContractAddress, caller_address: ContractAddress, span: CheatSpan,
)

start_cheat_caller_address_global

[source code]

Changes the caller address.

  • caller_address - caller address to be set

Fully qualified path: snforge_std::cheatcodes::execution_info::caller_address::start_cheat_caller_address_global

pub fn start_cheat_caller_address_global(caller_address: ContractAddress)

stop_cheat_caller_address_global

[source code]

Cancels the start_cheat_caller_address_global.

Fully qualified path: snforge_std::cheatcodes::execution_info::caller_address::stop_cheat_caller_address_global

pub fn stop_cheat_caller_address_global()

start_cheat_caller_address

[source code]

Changes the caller address for the given contract_address.

  • contract_address - instance of ContractAddress specifying which contract to cheat
  • caller_address - caller address to be set

Fully qualified path: snforge_std::cheatcodes::execution_info::caller_address::start_cheat_caller_address

pub fn start_cheat_caller_address(
    contract_address: ContractAddress, caller_address: ContractAddress,
)

stop_cheat_caller_address

[source code]

Cancels the cheat_caller_address / start_cheat_caller_address for the given contract_address.

  • contract_address - instance of ContractAddress specifying which contract to stop cheating

Fully qualified path: snforge_std::cheatcodes::execution_info::caller_address::stop_cheat_caller_address

pub fn stop_cheat_caller_address(contract_address: ContractAddress)

chain_id

[source code]

Fully qualified path: snforge_std::cheatcodes::execution_info::chain_id

Free functions

cheat_chain_idChanges the transaction chain_id for the given contract address and span….
start_cheat_chain_id_globalChanges the transaction chain_id….
stop_cheat_chain_id_globalCancels the start_cheat_chain_id_global .
start_cheat_chain_idChanges the transaction chain_id for the given contract_address….
stop_cheat_chain_idCancels the cheat_chain_id / start_cheat_chain_id for the given contract_address….

Free functions

Free functions

cheat_chain_idChanges the transaction chain_id for the given contract address and span….
start_cheat_chain_id_globalChanges the transaction chain_id….
stop_cheat_chain_id_globalCancels the start_cheat_chain_id_global .
start_cheat_chain_idChanges the transaction chain_id for the given contract_address….
stop_cheat_chain_idCancels the cheat_chain_id / start_cheat_chain_id for the given contract_address….

cheat_chain_id

[source code]

Changes the transaction chain_id for the given contract address and span.

  • contract_address - instance of ContractAddress specifying which contract to cheat
  • chain_id - transaction chain_id to be set
  • span - instance of CheatSpan specifying the number of contract calls with the cheat applied

Fully qualified path: snforge_std::cheatcodes::execution_info::chain_id::cheat_chain_id

pub fn cheat_chain_id(contract_address: ContractAddress, chain_id: felt252, span: CheatSpan)

start_cheat_chain_id_global

[source code]

Changes the transaction chain_id.

  • chain_id - transaction chain_id to be set

Fully qualified path: snforge_std::cheatcodes::execution_info::chain_id::start_cheat_chain_id_global

pub fn start_cheat_chain_id_global(chain_id: felt252)

stop_cheat_chain_id_global

[source code]

Cancels the start_cheat_chain_id_global.

Fully qualified path: snforge_std::cheatcodes::execution_info::chain_id::stop_cheat_chain_id_global

pub fn stop_cheat_chain_id_global()

start_cheat_chain_id

[source code]

Changes the transaction chain_id for the given contract_address.

  • contract_address - instance of ContractAddress specifying which contract to cheat
  • chain_id - transaction chain_id to be set

Fully qualified path: snforge_std::cheatcodes::execution_info::chain_id::start_cheat_chain_id

pub fn start_cheat_chain_id(contract_address: ContractAddress, chain_id: felt252)

stop_cheat_chain_id

[source code]

Cancels the cheat_chain_id / start_cheat_chain_id for the given contract_address.

  • contract_address - instance of ContractAddress specifying which contract to stop cheating

Fully qualified path: snforge_std::cheatcodes::execution_info::chain_id::stop_cheat_chain_id

pub fn stop_cheat_chain_id(contract_address: ContractAddress)

fee_data_availability_mode

[source code]

Fully qualified path: snforge_std::cheatcodes::execution_info::fee_data_availability_mode

Free functions

cheat_fee_data_availability_modeChanges the transaction fee data availability mode for the given contract address and span….
start_cheat_fee_data_availability_mode_globalChanges the transaction fee data availability mode….
stop_cheat_fee_data_availability_mode_globalCancels the start_cheat_fee_data_availability_mode_global .
start_cheat_fee_data_availability_modeChanges the transaction fee data availability mode for the given contract_address….
stop_cheat_fee_data_availability_modeCancels the cheat_fee_data_availability_mode / start_cheat_fee_data_availability_mode for the given contract_address….

Free functions

Free functions

cheat_fee_data_availability_modeChanges the transaction fee data availability mode for the given contract address and span….
start_cheat_fee_data_availability_mode_globalChanges the transaction fee data availability mode….
stop_cheat_fee_data_availability_mode_globalCancels the start_cheat_fee_data_availability_mode_global .
start_cheat_fee_data_availability_modeChanges the transaction fee data availability mode for the given contract_address….
stop_cheat_fee_data_availability_modeCancels the cheat_fee_data_availability_mode / start_cheat_fee_data_availability_mode for the given contract_address….

cheat_fee_data_availability_mode

[source code]

Changes the transaction fee data availability mode for the given contract address and span.

  • contract_address - instance of ContractAddress specifying which contracts to cheat
  • fee_data_availability_mode - transaction fee data availability mode to be set
  • span - instance of CheatSpan specifying the number of contract calls with the cheat applied

Fully qualified path: snforge_std::cheatcodes::execution_info::fee_data_availability_mode::cheat_fee_data_availability_mode

pub fn cheat_fee_data_availability_mode(
    contract_address: ContractAddress, fee_data_availability_mode: u32, span: CheatSpan,
)

start_cheat_fee_data_availability_mode_global

[source code]

Changes the transaction fee data availability mode.

  • fee_data_availability_mode - transaction fee data availability mode to be set

Fully qualified path: snforge_std::cheatcodes::execution_info::fee_data_availability_mode::start_cheat_fee_data_availability_mode_global

pub fn start_cheat_fee_data_availability_mode_global(fee_data_availability_mode: u32)

stop_cheat_fee_data_availability_mode_global

[source code]

Cancels the start_cheat_fee_data_availability_mode_global.

Fully qualified path: snforge_std::cheatcodes::execution_info::fee_data_availability_mode::stop_cheat_fee_data_availability_mode_global

pub fn stop_cheat_fee_data_availability_mode_global()

start_cheat_fee_data_availability_mode

[source code]

Changes the transaction fee data availability mode for the given contract_address.

  • contract_address - instance of ContractAddress specifying which contract to cheat
  • fee_data_availability_mode - transaction fee data availability mode to be set

Fully qualified path: snforge_std::cheatcodes::execution_info::fee_data_availability_mode::start_cheat_fee_data_availability_mode

pub fn start_cheat_fee_data_availability_mode(
    contract_address: ContractAddress, fee_data_availability_mode: u32,
)

stop_cheat_fee_data_availability_mode

[source code]

Cancels the cheat_fee_data_availability_mode / start_cheat_fee_data_availability_mode for the given contract_address.

  • contract_address - instance of ContractAddress specifying which contract to stop cheating

Fully qualified path: snforge_std::cheatcodes::execution_info::fee_data_availability_mode::stop_cheat_fee_data_availability_mode

pub fn stop_cheat_fee_data_availability_mode(contract_address: ContractAddress)

max_fee

[source code]

Fully qualified path: snforge_std::cheatcodes::execution_info::max_fee

Free functions

cheat_max_feeChanges the transaction max fee for the given contract address and span….
start_cheat_max_fee_globalChanges the transaction max fee….
stop_cheat_max_fee_globalCancels the start_cheat_max_fee_global .
start_cheat_max_feeChanges the transaction max fee for the given contract_address….
stop_cheat_max_feeCancels the cheat_max_fee / start_cheat_max_fee for the given contract_address….

Free functions

Free functions

cheat_max_feeChanges the transaction max fee for the given contract address and span….
start_cheat_max_fee_globalChanges the transaction max fee….
stop_cheat_max_fee_globalCancels the start_cheat_max_fee_global .
start_cheat_max_feeChanges the transaction max fee for the given contract_address….
stop_cheat_max_feeCancels the cheat_max_fee / start_cheat_max_fee for the given contract_address….

cheat_max_fee

[source code]

Changes the transaction max fee for the given contract address and span.

  • contract_address - instance of ContractAddress specifying which contract to cheat
  • max_fee - transaction max fee to be set
  • span - instance of CheatSpan specifying the number of contract calls with the cheat applied

Fully qualified path: snforge_std::cheatcodes::execution_info::max_fee::cheat_max_fee

pub fn cheat_max_fee(contract_address: ContractAddress, max_fee: u128, span: CheatSpan)

start_cheat_max_fee_global

[source code]

Changes the transaction max fee.

  • max_fee - transaction max fee to be set

Fully qualified path: snforge_std::cheatcodes::execution_info::max_fee::start_cheat_max_fee_global

pub fn start_cheat_max_fee_global(max_fee: u128)

stop_cheat_max_fee_global

[source code]

Cancels the start_cheat_max_fee_global.

Fully qualified path: snforge_std::cheatcodes::execution_info::max_fee::stop_cheat_max_fee_global

pub fn stop_cheat_max_fee_global()

start_cheat_max_fee

[source code]

Changes the transaction max fee for the given contract_address.

  • contract_address - instance of ContractAddress specifying which contract to cheat
  • max_fee - transaction max fee to be set

Fully qualified path: snforge_std::cheatcodes::execution_info::max_fee::start_cheat_max_fee

pub fn start_cheat_max_fee(contract_address: ContractAddress, max_fee: u128)

stop_cheat_max_fee

[source code]

Cancels the cheat_max_fee / start_cheat_max_fee for the given contract_address.

  • contract_address - instance of ContractAddress specifying which contract to stop cheating

Fully qualified path: snforge_std::cheatcodes::execution_info::max_fee::stop_cheat_max_fee

pub fn stop_cheat_max_fee(contract_address: ContractAddress)

nonce

[source code]

Fully qualified path: snforge_std::cheatcodes::execution_info::nonce

Free functions

cheat_nonceChanges the transaction nonce for the given contract address and span….
start_cheat_nonce_globalChanges the transaction nonce….
stop_cheat_nonce_globalCancels the start_cheat_nonce_global .
start_cheat_nonceChanges the transaction nonce for the given contract_address….
stop_cheat_nonceCancels the cheat_nonce / start_cheat_nonce for the given contract_address….

Free functions

Free functions

cheat_nonceChanges the transaction nonce for the given contract address and span….
start_cheat_nonce_globalChanges the transaction nonce….
stop_cheat_nonce_globalCancels the start_cheat_nonce_global .
start_cheat_nonceChanges the transaction nonce for the given contract_address….
stop_cheat_nonceCancels the cheat_nonce / start_cheat_nonce for the given contract_address….

cheat_nonce

[source code]

Changes the transaction nonce for the given contract address and span.

  • contract_address - instance of ContractAddress specifying which contract to cheat
  • nonce - transaction nonce to be set
  • span - instance of CheatSpan specifying the number of contract calls with the cheat applied

Fully qualified path: snforge_std::cheatcodes::execution_info::nonce::cheat_nonce

pub fn cheat_nonce(contract_address: ContractAddress, nonce: felt252, span: CheatSpan)

start_cheat_nonce_global

[source code]

Changes the transaction nonce.

  • nonce - transaction nonce to be set

Fully qualified path: snforge_std::cheatcodes::execution_info::nonce::start_cheat_nonce_global

pub fn start_cheat_nonce_global(nonce: felt252)

stop_cheat_nonce_global

[source code]

Cancels the start_cheat_nonce_global.

Fully qualified path: snforge_std::cheatcodes::execution_info::nonce::stop_cheat_nonce_global

pub fn stop_cheat_nonce_global()

start_cheat_nonce

[source code]

Changes the transaction nonce for the given contract_address.

  • contract_address - instance of ContractAddress specifying which contract to cheat
  • nonce - transaction nonce to be set

Fully qualified path: snforge_std::cheatcodes::execution_info::nonce::start_cheat_nonce

pub fn start_cheat_nonce(contract_address: ContractAddress, nonce: felt252)

stop_cheat_nonce

[source code]

Cancels the cheat_nonce / start_cheat_nonce for the given contract_address.

  • contract_address - instance of ContractAddress specifying which contract to stop cheating

Fully qualified path: snforge_std::cheatcodes::execution_info::nonce::stop_cheat_nonce

pub fn stop_cheat_nonce(contract_address: ContractAddress)

nonce_data_availability_mode

[source code]

Fully qualified path: snforge_std::cheatcodes::execution_info::nonce_data_availability_mode

Free functions

cheat_nonce_data_availability_modeChanges the transaction nonce data availability mode for the given contract address and span….
start_cheat_nonce_data_availability_mode_globalChanges the transaction nonce data availability mode….
stop_cheat_nonce_data_availability_mode_globalCancels the start_cheat_nonce_data_availability_mode_global .
start_cheat_nonce_data_availability_modeChanges the transaction nonce data availability mode for the given contract_address….
stop_cheat_nonce_data_availability_modeCancels the cheat_nonce_data_availability_mode / start_cheat_nonce_data_availability_mode for the given contract_address….

Free functions

Free functions

cheat_nonce_data_availability_modeChanges the transaction nonce data availability mode for the given contract address and span….
start_cheat_nonce_data_availability_mode_globalChanges the transaction nonce data availability mode….
stop_cheat_nonce_data_availability_mode_globalCancels the start_cheat_nonce_data_availability_mode_global .
start_cheat_nonce_data_availability_modeChanges the transaction nonce data availability mode for the given contract_address….
stop_cheat_nonce_data_availability_modeCancels the cheat_nonce_data_availability_mode / start_cheat_nonce_data_availability_mode for the given contract_address….

cheat_nonce_data_availability_mode

[source code]

Changes the transaction nonce data availability mode for the given contract address and span.

  • contract_address - instance of ContractAddress specifying which contracts to cheat
  • nonce_data_availability_mode - transaction nonce data availability mode to be set
  • span - instance of CheatSpan specifying the number of contract calls with the cheat applied

Fully qualified path: snforge_std::cheatcodes::execution_info::nonce_data_availability_mode::cheat_nonce_data_availability_mode

pub fn cheat_nonce_data_availability_mode(
    contract_address: ContractAddress, nonce_data_availability_mode: u32, span: CheatSpan,
)

start_cheat_nonce_data_availability_mode_global

[source code]

Changes the transaction nonce data availability mode.

  • nonce_data_availability_mode - transaction nonce data availability mode to be set

Fully qualified path: snforge_std::cheatcodes::execution_info::nonce_data_availability_mode::start_cheat_nonce_data_availability_mode_global

pub fn start_cheat_nonce_data_availability_mode_global(nonce_data_availability_mode: u32)

stop_cheat_nonce_data_availability_mode_global

[source code]

Cancels the start_cheat_nonce_data_availability_mode_global.

Fully qualified path: snforge_std::cheatcodes::execution_info::nonce_data_availability_mode::stop_cheat_nonce_data_availability_mode_global

pub fn stop_cheat_nonce_data_availability_mode_global()

start_cheat_nonce_data_availability_mode

[source code]

Changes the transaction nonce data availability mode for the given contract_address.

  • contract_address - instance of ContractAddress specifying which contract to cheat
  • nonce_data_availability_mode - transaction nonce data availability mode to be set

Fully qualified path: snforge_std::cheatcodes::execution_info::nonce_data_availability_mode::start_cheat_nonce_data_availability_mode

pub fn start_cheat_nonce_data_availability_mode(
    contract_address: ContractAddress, nonce_data_availability_mode: u32,
)

stop_cheat_nonce_data_availability_mode

[source code]

Cancels the cheat_nonce_data_availability_mode / start_cheat_nonce_data_availability_mode for the given contract_address.

  • contract_address - instance of ContractAddress specifying which contract to stop cheating

Fully qualified path: snforge_std::cheatcodes::execution_info::nonce_data_availability_mode::stop_cheat_nonce_data_availability_mode

pub fn stop_cheat_nonce_data_availability_mode(contract_address: ContractAddress)

paymaster_data

[source code]

Fully qualified path: snforge_std::cheatcodes::execution_info::paymaster_data

Free functions

cheat_paymaster_dataChanges the transaction paymaster data for the given contract address and span….
start_cheat_paymaster_data_globalChanges the transaction paymaster data….
stop_cheat_paymaster_data_globalCancels the start_cheat_paymaster_data_global .
start_cheat_paymaster_dataChanges the transaction paymaster data for the given contract_address….
stop_cheat_paymaster_dataCancels the cheat_paymaster_data / start_cheat_paymaster_data for the given contract_address….

Free functions

Free functions

cheat_paymaster_dataChanges the transaction paymaster data for the given contract address and span….
start_cheat_paymaster_data_globalChanges the transaction paymaster data….
stop_cheat_paymaster_data_globalCancels the start_cheat_paymaster_data_global .
start_cheat_paymaster_dataChanges the transaction paymaster data for the given contract_address….
stop_cheat_paymaster_dataCancels the cheat_paymaster_data / start_cheat_paymaster_data for the given contract_address….

cheat_paymaster_data

[source code]

Changes the transaction paymaster data for the given contract address and span.

  • contract_address - instance of ContractAddress specifying which contract to cheat
  • paymaster_data - transaction paymaster data to be set
  • span - instance of CheatSpan specifying the number of contract calls with the cheat applied

Fully qualified path: snforge_std::cheatcodes::execution_info::paymaster_data::cheat_paymaster_data

pub fn cheat_paymaster_data(
    contract_address: ContractAddress, paymaster_data: Span<felt252>, span: CheatSpan,
)

start_cheat_paymaster_data_global

[source code]

Changes the transaction paymaster data.

  • paymaster_data - transaction paymaster data to be set

Fully qualified path: snforge_std::cheatcodes::execution_info::paymaster_data::start_cheat_paymaster_data_global

pub fn start_cheat_paymaster_data_global(paymaster_data: Span<felt252>)

stop_cheat_paymaster_data_global

[source code]

Cancels the start_cheat_paymaster_data_global.

Fully qualified path: snforge_std::cheatcodes::execution_info::paymaster_data::stop_cheat_paymaster_data_global

pub fn stop_cheat_paymaster_data_global()

start_cheat_paymaster_data

[source code]

Changes the transaction paymaster data for the given contract_address.

  • contract_address - instance of ContractAddress specifying which contract to cheat
  • paymaster_data - transaction paymaster data to be set

Fully qualified path: snforge_std::cheatcodes::execution_info::paymaster_data::start_cheat_paymaster_data

pub fn start_cheat_paymaster_data(contract_address: ContractAddress, paymaster_data: Span<felt252>)

stop_cheat_paymaster_data

[source code]

Cancels the cheat_paymaster_data / start_cheat_paymaster_data for the given contract_address.

  • contract_address - instance of ContractAddress specifying which contract to stop cheating

Fully qualified path: snforge_std::cheatcodes::execution_info::paymaster_data::stop_cheat_paymaster_data

pub fn stop_cheat_paymaster_data(contract_address: ContractAddress)

resource_bounds

[source code]

Fully qualified path: snforge_std::cheatcodes::execution_info::resource_bounds

Free functions

cheat_resource_boundsChanges the transaction resource bounds for the given contract address and span….
start_cheat_resource_bounds_globalChanges the transaction resource bounds….
stop_cheat_resource_bounds_globalCancels the start_cheat_resource_bounds_global .
start_cheat_resource_boundsChanges the transaction resource bounds for the given contract_address….
stop_cheat_resource_boundsCancels the cheat_resource_bounds / start_cheat_resource_bounds for the given contract_address….

Free functions

Free functions

cheat_resource_boundsChanges the transaction resource bounds for the given contract address and span….
start_cheat_resource_bounds_globalChanges the transaction resource bounds….
stop_cheat_resource_bounds_globalCancels the start_cheat_resource_bounds_global .
start_cheat_resource_boundsChanges the transaction resource bounds for the given contract_address….
stop_cheat_resource_boundsCancels the cheat_resource_bounds / start_cheat_resource_bounds for the given contract_address….

cheat_resource_bounds

[source code]

Changes the transaction resource bounds for the given contract address and span.

  • contract_address - instance of ContractAddress specifying which contract to cheat
  • resource_bounds - transaction resource bounds to be set
  • span - instance of CheatSpan specifying the number of contract calls with the cheat applied

Fully qualified path: snforge_std::cheatcodes::execution_info::resource_bounds::cheat_resource_bounds

pub fn cheat_resource_bounds(
    contract_address: ContractAddress, resource_bounds: Span<ResourceBounds>, span: CheatSpan,
)

start_cheat_resource_bounds_global

[source code]

Changes the transaction resource bounds.

  • resource_bounds - transaction resource bounds to be set

Fully qualified path: snforge_std::cheatcodes::execution_info::resource_bounds::start_cheat_resource_bounds_global

pub fn start_cheat_resource_bounds_global(resource_bounds: Span<ResourceBounds>)

stop_cheat_resource_bounds_global

[source code]

Cancels the start_cheat_resource_bounds_global.

Fully qualified path: snforge_std::cheatcodes::execution_info::resource_bounds::stop_cheat_resource_bounds_global

pub fn stop_cheat_resource_bounds_global()

start_cheat_resource_bounds

[source code]

Changes the transaction resource bounds for the given contract_address.

  • contract_address - instance of ContractAddress specifying which contract to cheat
  • resource_bounds - transaction resource bounds to be set

Fully qualified path: snforge_std::cheatcodes::execution_info::resource_bounds::start_cheat_resource_bounds

pub fn start_cheat_resource_bounds(
    contract_address: ContractAddress, resource_bounds: Span<ResourceBounds>,
)

stop_cheat_resource_bounds

[source code]

Cancels the cheat_resource_bounds / start_cheat_resource_bounds for the given contract_address.

  • contract_address - instance of ContractAddress specifying which contract to stop cheating

Fully qualified path: snforge_std::cheatcodes::execution_info::resource_bounds::stop_cheat_resource_bounds

pub fn stop_cheat_resource_bounds(contract_address: ContractAddress)

sequencer_address

[source code]

Fully qualified path: snforge_std::cheatcodes::execution_info::sequencer_address

Free functions

cheat_sequencer_addressChanges the sequencer address for the given contract address and span….
start_cheat_sequencer_address_globalChanges the sequencer address….
stop_cheat_sequencer_address_globalCancels the start_cheat_sequencer_address_global .
start_cheat_sequencer_addressChanges the sequencer address for the given contract_address….
stop_cheat_sequencer_addressCancels the cheat_sequencer_address / start_cheat_sequencer_address for the given contract_address….

Free functions

Free functions

cheat_sequencer_addressChanges the sequencer address for the given contract address and span….
start_cheat_sequencer_address_globalChanges the sequencer address….
stop_cheat_sequencer_address_globalCancels the start_cheat_sequencer_address_global .
start_cheat_sequencer_addressChanges the sequencer address for the given contract_address….
stop_cheat_sequencer_addressCancels the cheat_sequencer_address / start_cheat_sequencer_address for the given contract_address….

cheat_sequencer_address

[source code]

Changes the sequencer address for the given contract address and span.

  • contract_address - instance of ContractAddress specifying which contract to cheat
  • sequencer_address - sequencer address to be set
  • span - instance of CheatSpan specifying the number of contract calls with the cheat applied

Fully qualified path: snforge_std::cheatcodes::execution_info::sequencer_address::cheat_sequencer_address

pub fn cheat_sequencer_address(
    contract_address: ContractAddress, sequencer_address: ContractAddress, span: CheatSpan,
)

start_cheat_sequencer_address_global

[source code]

Changes the sequencer address.

  • sequencer_address - sequencer address to be set

Fully qualified path: snforge_std::cheatcodes::execution_info::sequencer_address::start_cheat_sequencer_address_global

pub fn start_cheat_sequencer_address_global(sequencer_address: ContractAddress)

stop_cheat_sequencer_address_global

[source code]

Cancels the start_cheat_sequencer_address_global.

Fully qualified path: snforge_std::cheatcodes::execution_info::sequencer_address::stop_cheat_sequencer_address_global

pub fn stop_cheat_sequencer_address_global()

start_cheat_sequencer_address

[source code]

Changes the sequencer address for the given contract_address.

  • contract_address - instance of ContractAddress specifying which contract to cheat
  • sequencer_address - sequencer address to be set

Fully qualified path: snforge_std::cheatcodes::execution_info::sequencer_address::start_cheat_sequencer_address

pub fn start_cheat_sequencer_address(
    contract_address: ContractAddress, sequencer_address: ContractAddress,
)

stop_cheat_sequencer_address

[source code]

Cancels the cheat_sequencer_address / start_cheat_sequencer_address for the given contract_address.

  • contract_address - instance of ContractAddress specifying which contract to stop cheating

Fully qualified path: snforge_std::cheatcodes::execution_info::sequencer_address::stop_cheat_sequencer_address

pub fn stop_cheat_sequencer_address(contract_address: ContractAddress)

signature

[source code]

Fully qualified path: snforge_std::cheatcodes::execution_info::signature

Free functions

cheat_signatureChanges the transaction signature for the given contract address and span….
start_cheat_signature_globalChanges the transaction signature….
stop_cheat_signature_globalCancels the start_cheat_signature_global .
start_cheat_signatureChanges the transaction signature for the given contract_address….
stop_cheat_signatureCancels the cheat_signature / start_cheat_signature for the given contract_address….

Free functions

Free functions

cheat_signatureChanges the transaction signature for the given contract address and span….
start_cheat_signature_globalChanges the transaction signature….
stop_cheat_signature_globalCancels the start_cheat_signature_global .
start_cheat_signatureChanges the transaction signature for the given contract_address….
stop_cheat_signatureCancels the cheat_signature / start_cheat_signature for the given contract_address….

cheat_signature

[source code]

Changes the transaction signature for the given contract address and span.

  • contract_address - instance of ContractAddress specifying which contract to cheat
  • signature - transaction signature to be set
  • span - instance of CheatSpan specifying the number of contract calls with the cheat applied

Fully qualified path: snforge_std::cheatcodes::execution_info::signature::cheat_signature

pub fn cheat_signature(contract_address: ContractAddress, signature: Span<felt252>, span: CheatSpan)

start_cheat_signature_global

[source code]

Changes the transaction signature.

  • signature - transaction signature to be set

Fully qualified path: snforge_std::cheatcodes::execution_info::signature::start_cheat_signature_global

pub fn start_cheat_signature_global(signature: Span<felt252>)

stop_cheat_signature_global

[source code]

Cancels the start_cheat_signature_global.

Fully qualified path: snforge_std::cheatcodes::execution_info::signature::stop_cheat_signature_global

pub fn stop_cheat_signature_global()

start_cheat_signature

[source code]

Changes the transaction signature for the given contract_address.

  • contract_address - instance of ContractAddress specifying which contract to cheat
  • signature - transaction signature to be set

Fully qualified path: snforge_std::cheatcodes::execution_info::signature::start_cheat_signature

pub fn start_cheat_signature(contract_address: ContractAddress, signature: Span<felt252>)

stop_cheat_signature

[source code]

Cancels the cheat_signature / start_cheat_signature for the given contract_address.

  • contract_address - instance of ContractAddress specifying which contract to stop cheating

Fully qualified path: snforge_std::cheatcodes::execution_info::signature::stop_cheat_signature

pub fn stop_cheat_signature(contract_address: ContractAddress)

tip

[source code]

Fully qualified path: snforge_std::cheatcodes::execution_info::tip

Free functions

cheat_tipChanges the transaction tip for the given contract address and span….
start_cheat_tip_globalChanges the transaction tip….
stop_cheat_tip_globalCancels the start_cheat_tip_global .
start_cheat_tipChanges the transaction tip for the given contract_address….
stop_cheat_tipCancels the cheat_tip / start_cheat_tip for the given contract_address….

Free functions

Free functions

cheat_tipChanges the transaction tip for the given contract address and span….
start_cheat_tip_globalChanges the transaction tip….
stop_cheat_tip_globalCancels the start_cheat_tip_global .
start_cheat_tipChanges the transaction tip for the given contract_address….
stop_cheat_tipCancels the cheat_tip / start_cheat_tip for the given contract_address….

cheat_tip

[source code]

Changes the transaction tip for the given contract address and span.

  • contract_address - instance of ContractAddress specifying which contract to cheat
  • tip - transaction tip to be set
  • span - instance of CheatSpan specifying the number of contract calls with the cheat applied

Fully qualified path: snforge_std::cheatcodes::execution_info::tip::cheat_tip

pub fn cheat_tip(contract_address: ContractAddress, tip: u128, span: CheatSpan)

start_cheat_tip_global

[source code]

Changes the transaction tip.

  • tip - transaction tip to be set

Fully qualified path: snforge_std::cheatcodes::execution_info::tip::start_cheat_tip_global

pub fn start_cheat_tip_global(tip: u128)

stop_cheat_tip_global

[source code]

Cancels the start_cheat_tip_global.

Fully qualified path: snforge_std::cheatcodes::execution_info::tip::stop_cheat_tip_global

pub fn stop_cheat_tip_global()

start_cheat_tip

[source code]

Changes the transaction tip for the given contract_address.

  • contract_address - instance of ContractAddress specifying which contract to cheat
  • tip - transaction tip to be set

Fully qualified path: snforge_std::cheatcodes::execution_info::tip::start_cheat_tip

pub fn start_cheat_tip(contract_address: ContractAddress, tip: u128)

stop_cheat_tip

[source code]

Cancels the cheat_tip / start_cheat_tip for the given contract_address.

  • contract_address - instance of ContractAddress specifying which contract to stop cheating

Fully qualified path: snforge_std::cheatcodes::execution_info::tip::stop_cheat_tip

pub fn stop_cheat_tip(contract_address: ContractAddress)

transaction_hash

[source code]

Fully qualified path: snforge_std::cheatcodes::execution_info::transaction_hash

Free functions

cheat_transaction_hashChanges the transaction hash for the given contract address and span….
start_cheat_transaction_hash_globalChanges the transaction hash….
stop_cheat_transaction_hash_globalCancels the start_cheat_transaction_hash_global .
start_cheat_transaction_hashChanges the transaction hash for the given contract_address….
stop_cheat_transaction_hashCancels the cheat_transaction_hash / start_cheat_transaction_hash for the given contract_address….

Free functions

Free functions

cheat_transaction_hashChanges the transaction hash for the given contract address and span….
start_cheat_transaction_hash_globalChanges the transaction hash….
stop_cheat_transaction_hash_globalCancels the start_cheat_transaction_hash_global .
start_cheat_transaction_hashChanges the transaction hash for the given contract_address….
stop_cheat_transaction_hashCancels the cheat_transaction_hash / start_cheat_transaction_hash for the given contract_address….

cheat_transaction_hash

[source code]

Changes the transaction hash for the given contract address and span.

  • contract_address - instance of ContractAddress specifying which contract to cheat
  • transaction_hash - transaction hash to be set
  • span - instance of CheatSpan specifying the number of contract calls with the cheat applied

Fully qualified path: snforge_std::cheatcodes::execution_info::transaction_hash::cheat_transaction_hash

pub fn cheat_transaction_hash(
    contract_address: ContractAddress, transaction_hash: felt252, span: CheatSpan,
)

start_cheat_transaction_hash_global

[source code]

Changes the transaction hash.

  • transaction_hash - transaction hash to be set

Fully qualified path: snforge_std::cheatcodes::execution_info::transaction_hash::start_cheat_transaction_hash_global

pub fn start_cheat_transaction_hash_global(transaction_hash: felt252)

stop_cheat_transaction_hash_global

[source code]

Cancels the start_cheat_transaction_hash_global.

Fully qualified path: snforge_std::cheatcodes::execution_info::transaction_hash::stop_cheat_transaction_hash_global

pub fn stop_cheat_transaction_hash_global()

start_cheat_transaction_hash

[source code]

Changes the transaction hash for the given contract_address.

  • contract_address - instance of ContractAddress specifying which contract to cheat
  • transaction_hash - transaction hash to be set

Fully qualified path: snforge_std::cheatcodes::execution_info::transaction_hash::start_cheat_transaction_hash

pub fn start_cheat_transaction_hash(contract_address: ContractAddress, transaction_hash: felt252)

stop_cheat_transaction_hash

[source code]

Cancels the cheat_transaction_hash / start_cheat_transaction_hash for the given contract_address.

  • contract_address - instance of ContractAddress specifying which contract to stop cheating

Fully qualified path: snforge_std::cheatcodes::execution_info::transaction_hash::stop_cheat_transaction_hash

pub fn stop_cheat_transaction_hash(contract_address: ContractAddress)

version

[source code]

Fully qualified path: snforge_std::cheatcodes::execution_info::version

Free functions

cheat_transaction_versionChanges the transaction version for the given contract address and span….
start_cheat_transaction_version_globalChanges the transaction version….
stop_cheat_transaction_version_globalCancels the start_cheat_transaction_version_global .
start_cheat_transaction_versionChanges the transaction version for the given contract_address….
stop_cheat_transaction_versionCancels the cheat_transaction_version / start_cheat_transaction_version for the given contract_address….

Free functions

Free functions

cheat_transaction_versionChanges the transaction version for the given contract address and span….
start_cheat_transaction_version_globalChanges the transaction version….
stop_cheat_transaction_version_globalCancels the start_cheat_transaction_version_global .
start_cheat_transaction_versionChanges the transaction version for the given contract_address….
stop_cheat_transaction_versionCancels the cheat_transaction_version / start_cheat_transaction_version for the given contract_address….

cheat_transaction_version

[source code]

Changes the transaction version for the given contract address and span.

  • contract_address - instance of ContractAddress specifying which contract to cheat
  • version - transaction version to be set
  • span - instance of CheatSpan specifying the number of contract calls with the cheat applied

Fully qualified path: snforge_std::cheatcodes::execution_info::version::cheat_transaction_version

pub fn cheat_transaction_version(
    contract_address: ContractAddress, version: felt252, span: CheatSpan,
)

start_cheat_transaction_version_global

[source code]

Changes the transaction version.

  • version - transaction version to be set

Fully qualified path: snforge_std::cheatcodes::execution_info::version::start_cheat_transaction_version_global

pub fn start_cheat_transaction_version_global(version: felt252)

stop_cheat_transaction_version_global

[source code]

Cancels the start_cheat_transaction_version_global.

Fully qualified path: snforge_std::cheatcodes::execution_info::version::stop_cheat_transaction_version_global

pub fn stop_cheat_transaction_version_global()

start_cheat_transaction_version

[source code]

Changes the transaction version for the given contract_address.

  • contract_address - instance of ContractAddress specifying which contract to cheat
  • version - transaction version to be set

Fully qualified path: snforge_std::cheatcodes::execution_info::version::start_cheat_transaction_version

pub fn start_cheat_transaction_version(contract_address: ContractAddress, version: felt252)

stop_cheat_transaction_version

[source code]

Cancels the cheat_transaction_version / start_cheat_transaction_version for the given contract_address.

  • contract_address - instance of ContractAddress specifying which contract to stop cheating

Fully qualified path: snforge_std::cheatcodes::execution_info::version::stop_cheat_transaction_version

pub fn stop_cheat_transaction_version(contract_address: ContractAddress)

generate_arg

[source code]

Fully qualified path: snforge_std::cheatcodes::generate_arg

Free functions

Free functions

Free functions

generate_arg

[source code]

Fully qualified path: snforge_std::cheatcodes::generate_arg::generate_arg

pub fn generate_arg<T, +Serde<T>, +Drop<T>, +Into<T, felt252>>(min_value: T, max_value: T) -> T

generate_random_felt

[source code]

Fully qualified path: snforge_std::cheatcodes::generate_random_felt

Free functions

generate_random_feltGenerates a random felt value Returns a random felt within the range of 0 and 2^252 - 1

Free functions

Free functions

generate_random_feltGenerates a random felt value Returns a random felt within the range of 0 and 2^252 - 1

generate_random_felt

[source code]

Generates a random felt value

Returns a random felt within the range of 0 and 2^252 - 1

Fully qualified path: snforge_std::cheatcodes::generate_random_felt::generate_random_felt

pub fn generate_random_felt() -> felt252

l1_handler

[source code]

Fully qualified path: snforge_std::cheatcodes::l1_handler

Structs

Traits

Structs

Structs

L1Handler

[source code]

Fully qualified path: snforge_std::cheatcodes::l1_handler::L1Handler

[derive(Drop, Clone)]
pub struct L1Handler { /* private fields */ }

Traits

Traits

L1HandlerTrait

[source code]

Fully qualified path: snforge_std::cheatcodes::l1_handler::L1HandlerTrait

pub trait L1HandlerTrait

Trait functions

new

Fully qualified path: snforge_std::cheatcodes::l1_handler::L1HandlerTrait::new

fn new(target: ContractAddress, selector: felt252) -> L1Handler

execute

Fully qualified path: snforge_std::cheatcodes::l1_handler::L1HandlerTrait::execute

fn execute(
    self: L1Handler, from_address: felt252, payload: Span<felt252>,
) -> Result<(), Array<felt252>>

message_to_l1

[source code]

Fully qualified path: snforge_std::cheatcodes::message_to_l1

Free functions

spy_messages_to_l1Creates MessageToL1Spy instance that spies on all messages sent to L1

Structs

MessageToL1Raw message to L1 format (as seen via the RPC-API), can be used for asserting the sent messages.
MessageToL1SpyA message spy structure allowing to get messages emitted only after its creation.
MessagesToL1A wrapper structure on an array of messages to handle filtering smoothly.

Traits

MessageToL1SpyTrait
MessageToL1FilterTrait
MessageToL1SpyAssertionsTraitAllows to assert the expected sent messages (or lack thereof), in the scope of MessageToL1Spy structure.

Free functions

Free functions

spy_messages_to_l1Creates MessageToL1Spy instance that spies on all messages sent to L1

spy_messages_to_l1

[source code]

Creates MessageToL1Spy instance that spies on all messages sent to L1

Fully qualified path: snforge_std::cheatcodes::message_to_l1::spy_messages_to_l1

pub fn spy_messages_to_l1() -> MessageToL1Spy

Structs

Structs

MessageToL1Raw message to L1 format (as seen via the RPC-API), can be used for asserting the sent messages.
MessageToL1SpyA message spy structure allowing to get messages emitted only after its creation.
MessagesToL1A wrapper structure on an array of messages to handle filtering smoothly.

MessageToL1

[source code]

Raw message to L1 format (as seen via the RPC-API), can be used for asserting the sent messages.

Fully qualified path: snforge_std::cheatcodes::message_to_l1::MessageToL1

[derive(Drop, Clone, Serde)]
pub struct MessageToL1 {
    pub to_address: EthAddress,
    pub payload: Array<felt252>,
}

Members

to_address

An ethereum address where the message is destined to go

Fully qualified path: snforge_std::cheatcodes::message_to_l1::MessageToL1::to_address

pub to_address: EthAddress

payload

Actual payload which will be delivered to L1 contract

Fully qualified path: snforge_std::cheatcodes::message_to_l1::MessageToL1::payload

pub payload: Array<felt252>

MessageToL1Spy

[source code]

A message spy structure allowing to get messages emitted only after its creation.

Fully qualified path: snforge_std::cheatcodes::message_to_l1::MessageToL1Spy

[derive(Drop, Serde)]
pub struct MessageToL1Spy { /* private fields */ }

MessagesToL1

[source code]

A wrapper structure on an array of messages to handle filtering smoothly.

Fully qualified path: snforge_std::cheatcodes::message_to_l1::MessagesToL1

[derive(Drop, Serde)]
pub struct MessagesToL1 {
    pub messages: Array<(ContractAddress, MessageToL1)>,
}

Members

messages

Fully qualified path: snforge_std::cheatcodes::message_to_l1::MessagesToL1::messages

pub messages: Array<(ContractAddress, MessageToL1)>

Traits

Traits

MessageToL1SpyTrait
MessageToL1FilterTrait
MessageToL1SpyAssertionsTraitAllows to assert the expected sent messages (or lack thereof), in the scope of MessageToL1Spy structure.

MessageToL1SpyTrait

[source code]

Fully qualified path: snforge_std::cheatcodes::message_to_l1::MessageToL1SpyTrait

pub trait MessageToL1SpyTrait

Trait functions

get_messages

Gets all messages given MessageToL1Spy spies for.

Fully qualified path: snforge_std::cheatcodes::message_to_l1::MessageToL1SpyTrait::get_messages

fn get_messages(ref self: MessageToL1Spy) -> MessagesToL1

MessageToL1FilterTrait

[source code]

Fully qualified path: snforge_std::cheatcodes::message_to_l1::MessageToL1FilterTrait

pub trait MessageToL1FilterTrait

Trait functions

sent_by

Filter messages emitted by a sender of a given ContractAddress

Fully qualified path: snforge_std::cheatcodes::message_to_l1::MessageToL1FilterTrait::sent_by

fn sent_by(self: MessagesToL1, contract_address: ContractAddress) -> MessagesToL1

sent_to

Filter messages emitted by a receiver of a given ethereum address

Fully qualified path: snforge_std::cheatcodes::message_to_l1::MessageToL1FilterTrait::sent_to

fn sent_to(self: MessagesToL1, to_address: EthAddress) -> MessagesToL1

MessageToL1SpyAssertionsTrait

[source code]

Allows to assert the expected sent messages (or lack thereof), in the scope of MessageToL1Spy structure.

Fully qualified path: snforge_std::cheatcodes::message_to_l1::MessageToL1SpyAssertionsTrait

pub trait MessageToL1SpyAssertionsTrait

Trait functions

assert_sent

Fully qualified path: snforge_std::cheatcodes::message_to_l1::MessageToL1SpyAssertionsTrait::assert_sent

fn assert_sent(ref self: MessageToL1Spy, messages: Array<(ContractAddress, MessageToL1)>)

assert_not_sent

Fully qualified path: snforge_std::cheatcodes::message_to_l1::MessageToL1SpyAssertionsTrait::assert_not_sent

fn assert_not_sent(ref self: MessageToL1Spy, messages: Array<(ContractAddress, MessageToL1)>)

storage

[source code]

Fully qualified path: snforge_std::cheatcodes::storage

Free functions

storeStores felts from serialized_value in target contract’s storage, starting at storage_address ….
loadLoads size felts from target contract’s storage into an Array , starting at storage_address ….
map_entry_address
interact_with_state

Free functions

Free functions

storeStores felts from serialized_value in target contract’s storage, starting at storage_address ….
loadLoads size felts from target contract’s storage into an Array , starting at storage_address ….
map_entry_address
interact_with_state

store

[source code]

Stores felts from serialized_value in target contract’s storage, starting at storage_address.

  • target - address of the contract, which storage you want to modify
  • storage_address - offset of the data in the contract’s storage
  • serialized_value - a sequence of felts that will be inserted starting at storage_address

Fully qualified path: snforge_std::cheatcodes::storage::store

pub fn store(target: ContractAddress, storage_address: felt252, serialized_value: Span<felt252>)

load

[source code]

Loads size felts from target contract’s storage into an Array, starting at storage_address.

  • target - address of the contract, which storage you want to modify
  • storage_address - offset of the data in the contract’s storage
  • size - how many felts will be loaded into the result Array

Fully qualified path: snforge_std::cheatcodes::storage::load

pub fn load(target: ContractAddress, storage_address: felt252, size: felt252) -> Array<felt252>

map_entry_address

[source code]

Fully qualified path: snforge_std::cheatcodes::storage::map_entry_address

pub fn map_entry_address(map_selector: felt252, keys: Span<felt252>) -> felt252

interact_with_state

[source code]

Fully qualified path: snforge_std::cheatcodes::storage::interact_with_state

pub fn interact_with_state<F, +Drop<F>, impl func: FnOnce<F, ()>, +Drop<func::Output>>(
    contract_address: ContractAddress, f: F,
) -> Output

Free functions

Free functions

test_selector
test_address
mock_callMocks contract call to a function_selector of a contract at the given address, for n_times first calls that are made to the contract. A call to function function_selector
start_mock_callMocks contract call to a function of a contract at the given address, indefinitely. See mock_call for comprehensive definition of how it can be used….
stop_mock_callCancels the mock_call / start_mock_call for the function with given name and contract address….
replace_bytecodeReplaces class for given contract address. The new_class hash has to be declared in order for the replacement class to execute the code, when interacting with the contract….

test_selector

[source code]

Fully qualified path: snforge_std::cheatcodes::test_selector

pub fn test_selector() -> felt252

test_address

[source code]

Fully qualified path: snforge_std::cheatcodes::test_address

pub fn test_address() -> ContractAddress

mock_call

[source code]

Mocks contract call to a function_selector of a contract at the given address, for n_times first calls that are made to the contract. A call to function function_selector will return data provided in ret_data argument. An address with no contract can be mocked as well. An entrypoint that is not present on the deployed contract is also possible to mock. Note that the function is not meant for mocking internal calls - it works only for contract entry points.

  • contract_address - target contract address
  • function_selector - hashed name of the target function (can be obtained with selector! macro)
  • ret_data - data to return by the function function_selector
  • n_times - number of calls to mock the function for

Fully qualified path: snforge_std::cheatcodes::mock_call

pub fn mock_call<T, impl TSerde: Serde<T>, impl TDestruct: Destruct<T>>(
    contract_address: ContractAddress, function_selector: felt252, ret_data: T, n_times: u32,
)

start_mock_call

[source code]

Mocks contract call to a function of a contract at the given address, indefinitely. See mock_call for comprehensive definition of how it can be used.

  • contract_address - targeted contracts’ address
  • function_selector - hashed name of the target function (can be obtained with selector! macro)
  • ret_data - data to be returned by the function

Fully qualified path: snforge_std::cheatcodes::start_mock_call

pub fn start_mock_call<T, impl TSerde: Serde<T>, impl TDestruct: Destruct<T>>(
    contract_address: ContractAddress, function_selector: felt252, ret_data: T,
)

stop_mock_call

[source code]

Cancels the mock_call / start_mock_call for the function with given name and contract address.

  • contract_address - targeted contracts’ address
  • function_selector - hashed name of the target function (can be obtained with selector! macro)

Fully qualified path: snforge_std::cheatcodes::stop_mock_call

pub fn stop_mock_call(contract_address: ContractAddress, function_selector: felt252)

replace_bytecode

[source code]

Replaces class for given contract address. The new_class hash has to be declared in order for the replacement class to execute the code, when interacting with the contract.

  • contract - address specifying which address will be replaced
  • new_class - class hash, that will be used now for given address Returns Result::Ok if the replacement succeeded, and a ReplaceBytecodeError with appropriate error type otherwise

Fully qualified path: snforge_std::cheatcodes::replace_bytecode

pub fn replace_bytecode(
    contract: ContractAddress, new_class: ClassHash,
) -> Result<(), ReplaceBytecodeError>

Enums

Enums

CheatSpanEnum used to specify how long the target should be cheated for.
ReplaceBytecodeError

CheatSpan

[source code]

Enum used to specify how long the target should be cheated for.

Fully qualified path: snforge_std::cheatcodes::CheatSpan

pub enum CheatSpan {
    Indefinite,
    TargetCalls: NonZero<u32>,
}

Variants

Indefinite

Applies the cheatcode indefinitely, until the cheat is canceled manually (e.g. using stop_cheat_block_timestamp).

Fully qualified path: snforge_std::cheatcodes::CheatSpan::Indefinite

Indefinite

TargetCalls

Applies the cheatcode for a specified number of calls to the target, after which the cheat is canceled (or until the cheat is canceled manually).

Fully qualified path: snforge_std::cheatcodes::CheatSpan::TargetCalls

TargetCalls: NonZero<u32>

ReplaceBytecodeError

[source code]

Fully qualified path: snforge_std::cheatcodes::ReplaceBytecodeError

pub enum ReplaceBytecodeError {
    ContractNotDeployed,
    UndeclaredClassHash,
}

Variants

ContractNotDeployed

Means that the contract does not exist, and thus bytecode cannot be replaced

Fully qualified path: snforge_std::cheatcodes::ReplaceBytecodeError::ContractNotDeployed

ContractNotDeployed

UndeclaredClassHash

Means that the given class for replacement is not declared

Fully qualified path: snforge_std::cheatcodes::ReplaceBytecodeError::UndeclaredClassHash

UndeclaredClassHash

byte_array

[source code]

Fully qualified path: snforge_std::byte_array

Free functions

byte_array_as_felt_array
try_deserialize_bytearray_errorThis function is meant to transform a serialized output from a contract call into a ByteArray . x - Span of felt252 s returned from a contract call (panic data) Returns the parsed ByteArray

Free functions

Free functions

byte_array_as_felt_array
try_deserialize_bytearray_errorThis function is meant to transform a serialized output from a contract call into a ByteArray . x - Span of felt252 s returned from a contract call (panic data) Returns the parsed ByteArray

byte_array_as_felt_array

[source code]

Fully qualified path: snforge_std::byte_array::byte_array_as_felt_array

pub fn byte_array_as_felt_array(self: ByteArray) -> Array<felt252>

try_deserialize_bytearray_error

[source code]

This function is meant to transform a serialized output from a contract call into a ByteArray. x - Span of felt252s returned from a contract call (panic data) Returns the parsed ByteArray, or an Err if the parsing failed.

Fully qualified path: snforge_std::byte_array::try_deserialize_bytearray_error

pub fn try_deserialize_bytearray_error(x: Span<felt252>) -> Result<ByteArray, ByteArray>

env

[source code]

Fully qualified path: snforge_std::env

Modules


Re-exports:

varReads an environment variable, without parsing it name - name of an environment variable Returns the read array of felts

Modules

Modules

env_vars

[source code]

Fully qualified path: snforge_std::env::env_vars

Free functions

varReads an environment variable, without parsing it name - name of an environment variable Returns the read array of felts

Free functions

Free functions

varReads an environment variable, without parsing it name - name of an environment variable Returns the read array of felts

var

[source code]

Reads an environment variable, without parsing it name - name of an environment variable Returns the read array of felts

Fully qualified path: snforge_std::env::env_vars::var

pub fn var(name: ByteArray) -> Array<felt252>

fs

[source code]

Fully qualified path: snforge_std::fs

Modules


Re-exports:

read_jsonfile - a File struct to read json data from Returns an array of felts read from the file, panics if read was not possible, or json was incorrect
read_txtfile - a File struct to read text data from Returns an array of felts read from the file, panics if read was not possible

File


Modules

Modules

file_operations

[source code]

Fully qualified path: snforge_std::fs::file_operations

Free functions

read_jsonfile - a File struct to read json data from Returns an array of felts read from the file, panics if read was not possible, or json was incorrect
read_txtfile - a File struct to read text data from Returns an array of felts read from the file, panics if read was not possible

Structs

File

Traits

Free functions

Free functions

read_jsonfile - a File struct to read json data from Returns an array of felts read from the file, panics if read was not possible, or json was incorrect
read_txtfile - a File struct to read text data from Returns an array of felts read from the file, panics if read was not possible

read_json

[source code]

file - a File struct to read json data from Returns an array of felts read from the file, panics if read was not possible, or json was incorrect

Fully qualified path: snforge_std::fs::file_operations::read_json

pub fn read_json(file: File) -> Array<felt252>

read_txt

[source code]

file - a File struct to read text data from Returns an array of felts read from the file, panics if read was not possible

Fully qualified path: snforge_std::fs::file_operations::read_txt

pub fn read_txt(file: File) -> Array<felt252>

Structs

Structs

File

File

[source code]

Fully qualified path: snforge_std::fs::file_operations::File

[derive(Drop, Clone)]
pub struct File { /* private fields */ }

Traits

Traits

FileParser

[source code]

Fully qualified path: snforge_std::fs::file_operations::FileParser

pub trait FileParser<T, impl TSerde: Serde<T>>

Trait functions

parse_txt

Reads from the text file and tries to deserialize the result into given type with Serde file - File instance Returns an instance of T if deserialization was possible

Fully qualified path: snforge_std::fs::file_operations::FileParser::parse_txt

fn parse_txt(file: File) -> Option<T>

parse_json

Reads from the json file and tries to deserialize the result into given type with Serde file - File instance Returns an instance of T if deserialization was possible

Fully qualified path: snforge_std::fs::file_operations::FileParser::parse_json

fn parse_json(file: File) -> Option<T>

FileTrait

[source code]

Fully qualified path: snforge_std::fs::file_operations::FileTrait

pub trait FileTrait

Trait functions

new

Creates a file struct used for reading json / text path - a path to file in ByteArray form, relative to the package root

Fully qualified path: snforge_std::fs::file_operations::FileTrait::new

fn new(path: ByteArray) -> File

fuzzable

[source code]

Fully qualified path: snforge_std::fuzzable

Impl aliases

Traits

Impls


Re-exports:


Impl aliases

Impl aliases

FuzzableU8

[source code]

Fully qualified path: snforge_std::fuzzable::FuzzableU8

pub impl FuzzableU8 = nums::FuzzableNum<u8>;

FuzzableU16

[source code]

Fully qualified path: snforge_std::fuzzable::FuzzableU16

pub impl FuzzableU16 = nums::FuzzableNum<u16>;

FuzzableU32

[source code]

Fully qualified path: snforge_std::fuzzable::FuzzableU32

pub impl FuzzableU32 = nums::FuzzableNum<u32>;

FuzzableU64

[source code]

Fully qualified path: snforge_std::fuzzable::FuzzableU64

pub impl FuzzableU64 = nums::FuzzableNum<u64>;

FuzzableU128

[source code]

Fully qualified path: snforge_std::fuzzable::FuzzableU128

pub impl FuzzableU128 = nums::FuzzableNum<u128>;

FuzzableI8

[source code]

Fully qualified path: snforge_std::fuzzable::FuzzableI8

pub impl FuzzableI8 = nums::FuzzableNum<i8>;

FuzzableI16

[source code]

Fully qualified path: snforge_std::fuzzable::FuzzableI16

pub impl FuzzableI16 = nums::FuzzableNum<i16>;

FuzzableI32

[source code]

Fully qualified path: snforge_std::fuzzable::FuzzableI32

pub impl FuzzableI32 = nums::FuzzableNum<i32>;

FuzzableI64

[source code]

Fully qualified path: snforge_std::fuzzable::FuzzableI64

pub impl FuzzableI64 = nums::FuzzableNum<i64>;

FuzzableI128

[source code]

Fully qualified path: snforge_std::fuzzable::FuzzableI128

pub impl FuzzableI128 = nums::FuzzableNum<i128>;

Traits

Traits

Fuzzable

[source code]

Fully qualified path: snforge_std::fuzzable::Fuzzable

pub trait Fuzzable<T, +Debug<T>>

Trait functions

blank

Fully qualified path: snforge_std::fuzzable::Fuzzable::blank

fn blank() -> T

generate

Fully qualified path: snforge_std::fuzzable::Fuzzable::generate

fn generate() -> T

Impls

Impls

FuzzableU256

[source code]

Fully qualified path: snforge_std::fuzzable::FuzzableU256

pub impl FuzzableU256 of Fuzzable<
    u256, DebugInteger<u256, U256AppendFormattedToByteArray, U8IntoU256, U256TryIntoNonZero>,
>;

Impl functions

blank

Fully qualified path: snforge_std::fuzzable::FuzzableU256::blank

fn blank() -> u256

generate

Fully qualified path: snforge_std::fuzzable::FuzzableU256::generate

fn generate() -> u256

FuzzableByteArray1000ASCII

[source code]

Fully qualified path: snforge_std::fuzzable::FuzzableByteArray1000ASCII

pub impl FuzzableByteArray1000ASCII of Fuzzable<ByteArray, DebugByteArray>;

Impl functions

blank

Fully qualified path: snforge_std::fuzzable::FuzzableByteArray1000ASCII::blank

fn blank() -> ByteArray

generate

Fully qualified path: snforge_std::fuzzable::FuzzableByteArray1000ASCII::generate

fn generate() -> ByteArray

FuzzableBool

[source code]

Fully qualified path: snforge_std::fuzzable::FuzzableBool

pub impl FuzzableBool of Fuzzable<bool, DebugBool>;

Impl functions

blank

Fully qualified path: snforge_std::fuzzable::FuzzableBool::blank

fn blank() -> bool

generate

Fully qualified path: snforge_std::fuzzable::FuzzableBool::generate

fn generate() -> bool

FuzzableContractAddress

[source code]

Fully qualified path: snforge_std::fuzzable::FuzzableContractAddress

pub impl FuzzableContractAddress of Fuzzable<
    ContractAddress, DebugImpl<ContractAddress, ContractAddressIntoFelt252, ContractAddressCopy>,
>;

Impl functions

blank

Fully qualified path: snforge_std::fuzzable::FuzzableContractAddress::blank

fn blank() -> ContractAddress

generate

Fully qualified path: snforge_std::fuzzable::FuzzableContractAddress::generate

fn generate() -> ContractAddress

signature

[source code]

Fully qualified path: snforge_std::signature

Modules

Structs

KeyPair

Enums

Traits

Modules

Modules

secp256k1_curve

[source code]

Fully qualified path: snforge_std::signature::secp256k1_curve

Type aliases

Impls

Type aliases

Type aliases

Secp256k1CurveKeyPair

[source code]

Fully qualified path: snforge_std::signature::secp256k1_curve::Secp256k1CurveKeyPair

pub type Secp256k1CurveKeyPair = KeyPair<u256, Secp256k1Point>;

Impls

Impls

Secp256k1CurveKeyPairImpl

[source code]

Fully qualified path: snforge_std::signature::secp256k1_curve::Secp256k1CurveKeyPairImpl

pub impl Secp256k1CurveKeyPairImpl of KeyPairTrait<u256, Secp256k1Point>;

Impl functions

generate

Fully qualified path: snforge_std::signature::secp256k1_curve::Secp256k1CurveKeyPairImpl::generate

fn generate() -> KeyPair<u256, Secp256k1Point>

from_secret_key

Fully qualified path: snforge_std::signature::secp256k1_curve::Secp256k1CurveKeyPairImpl::from_secret_key

fn from_secret_key(secret_key: u256) -> KeyPair<u256, Secp256k1Point>

Secp256k1CurveSignerImpl

[source code]

Fully qualified path: snforge_std::signature::secp256k1_curve::Secp256k1CurveSignerImpl

pub impl Secp256k1CurveSignerImpl of SignerTrait<KeyPair<u256, Secp256k1Point>, u256, (u256, u256)>;

Impl functions

sign

Fully qualified path: snforge_std::signature::secp256k1_curve::Secp256k1CurveSignerImpl::sign

fn sign(self: KeyPair<u256, Secp256k1Point>, message_hash: u256) -> Result<(u256, u256), SignError>

Secp256k1CurveVerifierImpl

[source code]

Fully qualified path: snforge_std::signature::secp256k1_curve::Secp256k1CurveVerifierImpl

pub impl Secp256k1CurveVerifierImpl of VerifierTrait<
    KeyPair<u256, Secp256k1Point>, u256, (u256, u256),
>;

Impl functions

verify

Fully qualified path: snforge_std::signature::secp256k1_curve::Secp256k1CurveVerifierImpl::verify

fn verify(self: KeyPair<u256, Secp256k1Point>, message_hash: u256, signature: (u256, u256)) -> bool

secp256r1_curve

[source code]

Fully qualified path: snforge_std::signature::secp256r1_curve

Type aliases

Impls

Type aliases

Type aliases

Secp256r1CurveKeyPair

[source code]

Fully qualified path: snforge_std::signature::secp256r1_curve::Secp256r1CurveKeyPair

pub type Secp256r1CurveKeyPair = KeyPair<u256, Secp256r1Point>;

Impls

Impls

Secp256r1CurveKeyPairImpl

[source code]

Fully qualified path: snforge_std::signature::secp256r1_curve::Secp256r1CurveKeyPairImpl

pub impl Secp256r1CurveKeyPairImpl of KeyPairTrait<u256, Secp256r1Point>;

Impl functions

generate

Fully qualified path: snforge_std::signature::secp256r1_curve::Secp256r1CurveKeyPairImpl::generate

fn generate() -> KeyPair<u256, Secp256r1Point>

from_secret_key

Fully qualified path: snforge_std::signature::secp256r1_curve::Secp256r1CurveKeyPairImpl::from_secret_key

fn from_secret_key(secret_key: u256) -> KeyPair<u256, Secp256r1Point>

Secp256r1CurveSignerImpl

[source code]

Fully qualified path: snforge_std::signature::secp256r1_curve::Secp256r1CurveSignerImpl

pub impl Secp256r1CurveSignerImpl of SignerTrait<KeyPair<u256, Secp256r1Point>, u256, (u256, u256)>;

Impl functions

sign

Fully qualified path: snforge_std::signature::secp256r1_curve::Secp256r1CurveSignerImpl::sign

fn sign(self: KeyPair<u256, Secp256r1Point>, message_hash: u256) -> Result<(u256, u256), SignError>

Secp256r1CurveVerifierImpl

[source code]

Fully qualified path: snforge_std::signature::secp256r1_curve::Secp256r1CurveVerifierImpl

pub impl Secp256r1CurveVerifierImpl of VerifierTrait<
    KeyPair<u256, Secp256r1Point>, u256, (u256, u256),
>;

Impl functions

verify

Fully qualified path: snforge_std::signature::secp256r1_curve::Secp256r1CurveVerifierImpl::verify

fn verify(self: KeyPair<u256, Secp256r1Point>, message_hash: u256, signature: (u256, u256)) -> bool

stark_curve

[source code]

Fully qualified path: snforge_std::signature::stark_curve

Type aliases

Impls

Type aliases

Type aliases

StarkCurveKeyPair

[source code]

Fully qualified path: snforge_std::signature::stark_curve::StarkCurveKeyPair

pub type StarkCurveKeyPair = KeyPair<felt252, felt252>;

Impls

Impls

StarkCurveKeyPairImpl

[source code]

Fully qualified path: snforge_std::signature::stark_curve::StarkCurveKeyPairImpl

pub impl StarkCurveKeyPairImpl of KeyPairTrait<felt252, felt252>;

Impl functions

generate

Fully qualified path: snforge_std::signature::stark_curve::StarkCurveKeyPairImpl::generate

fn generate() -> KeyPair<felt252, felt252>

from_secret_key

Fully qualified path: snforge_std::signature::stark_curve::StarkCurveKeyPairImpl::from_secret_key

fn from_secret_key(secret_key: felt252) -> KeyPair<felt252, felt252>

StarkCurveSignerImpl

[source code]

Fully qualified path: snforge_std::signature::stark_curve::StarkCurveSignerImpl

pub impl StarkCurveSignerImpl of SignerTrait<
    KeyPair<felt252, felt252>, felt252, (felt252, felt252),
>;

Impl functions

sign

Fully qualified path: snforge_std::signature::stark_curve::StarkCurveSignerImpl::sign

fn sign(
    self: KeyPair<felt252, felt252>, message_hash: felt252,
) -> Result<(felt252, felt252), SignError>

StarkCurveVerifierImpl

[source code]

Fully qualified path: snforge_std::signature::stark_curve::StarkCurveVerifierImpl

pub impl StarkCurveVerifierImpl of VerifierTrait<
    KeyPair<felt252, felt252>, felt252, (felt252, felt252),
>;

Impl functions

verify

Fully qualified path: snforge_std::signature::stark_curve::StarkCurveVerifierImpl::verify

fn verify(
    self: KeyPair<felt252, felt252>, message_hash: felt252, signature: (felt252, felt252),
) -> bool

Structs

Structs

KeyPair

KeyPair

[source code]

Fully qualified path: snforge_std::signature::KeyPair

[derive(Copy, Drop)]
pub struct KeyPair<SK, PK> {
    pub secret_key: SK,
    pub public_key: PK,
}

Members

secret_key

A key that is used for signing the messages

Fully qualified path: snforge_std::signature::KeyPair::secret_key

pub secret_key: SK

public_key

A (x, y) point on the elliptic curve used for verification of the signature

Fully qualified path: snforge_std::signature::KeyPair::public_key

pub public_key: PK

Enums

Enums

SignError

[source code]

Fully qualified path: snforge_std::signature::SignError

pub enum SignError {
    InvalidSecretKey,
    HashOutOfRange,
}

Variants

InvalidSecretKey

Fully qualified path: snforge_std::signature::SignError::InvalidSecretKey

InvalidSecretKey

HashOutOfRange

Fully qualified path: snforge_std::signature::SignError::HashOutOfRange

HashOutOfRange

Traits

Traits

KeyPairTrait

[source code]

Fully qualified path: snforge_std::signature::KeyPairTrait

pub trait KeyPairTrait<SK, PK>

Trait functions

generate

Generates the private and public keys using the built-in random generator

Fully qualified path: snforge_std::signature::KeyPairTrait::generate

fn generate() -> KeyPair<SK, PK>

from_secret_key

Derives the KeyPair (secret_key + public_key) using secret_key

Fully qualified path: snforge_std::signature::KeyPairTrait::from_secret_key

fn from_secret_key(secret_key: SK) -> KeyPair<SK, PK>

SignerTrait

[source code]

Fully qualified path: snforge_std::signature::SignerTrait

pub trait SignerTrait<T, H, U>

Trait functions

sign

Signs given message hash self - KeyPair used for signing message_hash - input to sign bounded by the curve type (u256 for 256bit curves, felt252 for StarkCurve) Returns the signature components (usually r,s tuple) or error

Fully qualified path: snforge_std::signature::SignerTrait::sign

fn sign(self: T, message_hash: H) -> Result<U, SignError>

VerifierTrait

[source code]

Fully qualified path: snforge_std::signature::VerifierTrait

pub trait VerifierTrait<T, H, U>

Trait functions

verify

self - KeyPair used for verifying message_hash - input to verify bounded by the curve type (u256 for 256bit curves, felt252 for StarkCurve) signature - the signature components (usually r,s tuple) Returns a boolean representing the validity of the signature

Fully qualified path: snforge_std::signature::VerifierTrait::verify

fn verify(self: T, message_hash: H, signature: U) -> bool

testing

[source code]

Fully qualified path: snforge_std::testing

Free functions

get_current_vm_stepGets the current step during test execution

Free functions

Free functions

get_current_vm_stepGets the current step during test execution

get_current_vm_step

[source code]

Gets the current step during test execution

Fully qualified path: snforge_std::testing::get_current_vm_step

pub fn get_current_vm_step() -> u32

trace

[source code]

Fully qualified path: snforge_std::trace

Free functions

get_call_traceReturns current call trace of the test, up to the last call made to a contract

Structs

CallTraceTree-like structure which contains all of the starknet calls and sub-calls along with the results
CallEntryPointA single function entry point summary

Enums

EntryPointTypeType of the function being invoked
CallTypeDenotes type of the call
CallResultResult of a contract or a library call
CallFailureRepresents a pre-processed failure of a call

Free functions

Free functions

get_call_traceReturns current call trace of the test, up to the last call made to a contract

get_call_trace

[source code]

Returns current call trace of the test, up to the last call made to a contract

Fully qualified path: snforge_std::trace::get_call_trace

pub fn get_call_trace() -> CallTrace

Structs

Structs

CallTraceTree-like structure which contains all of the starknet calls and sub-calls along with the results
CallEntryPointA single function entry point summary

CallTrace

[source code]

Tree-like structure which contains all of the starknet calls and sub-calls along with the results

Fully qualified path: snforge_std::trace::CallTrace

#[derive(Drop, Serde, PartialEq, Clone, Debug)]
pub struct CallTrace {
    pub entry_point: CallEntryPoint,
    pub nested_calls: Array<CallTrace>,
    pub result: CallResult,
}

Members

entry_point

Fully qualified path: snforge_std::trace::CallTrace::entry_point

pub entry_point: CallEntryPoint

nested_calls

All the calls that happened in the scope of entry_point

Fully qualified path: snforge_std::trace::CallTrace::nested_calls

pub nested_calls: Array<CallTrace>

result

Fully qualified path: snforge_std::trace::CallTrace::result

pub result: CallResult

CallEntryPoint

[source code]

A single function entry point summary

Fully qualified path: snforge_std::trace::CallEntryPoint

#[derive(Drop, Serde, PartialEq, Clone, Debug)]
pub struct CallEntryPoint {
    pub entry_point_type: EntryPointType,
    pub entry_point_selector: felt252,
    pub calldata: Array<felt252>,
    pub contract_address: ContractAddress,
    pub caller_address: ContractAddress,
    pub call_type: CallType,
}

Members

entry_point_type

Fully qualified path: snforge_std::trace::CallEntryPoint::entry_point_type

pub entry_point_type: EntryPointType

entry_point_selector

Hashed selector of the invoked function

Fully qualified path: snforge_std::trace::CallEntryPoint::entry_point_selector

pub entry_point_selector: felt252

calldata

Serialized arguments calldata

Fully qualified path: snforge_std::trace::CallEntryPoint::calldata

pub calldata: Array<felt252>

contract_address

Contract address targeted by the call

Fully qualified path: snforge_std::trace::CallEntryPoint::contract_address

pub contract_address: ContractAddress

caller_address

Address that the call originates from

Fully qualified path: snforge_std::trace::CallEntryPoint::caller_address

pub caller_address: ContractAddress

call_type

Fully qualified path: snforge_std::trace::CallEntryPoint::call_type

pub call_type: CallType

Enums

Enums

EntryPointTypeType of the function being invoked
CallTypeDenotes type of the call
CallResultResult of a contract or a library call
CallFailureRepresents a pre-processed failure of a call

EntryPointType

[source code]

Type of the function being invoked

Fully qualified path: snforge_std::trace::EntryPointType

pub enum EntryPointType {
    Constructor,
    External,
    L1Handler,
}

Variants

Constructor

Constructor of a contract

Fully qualified path: snforge_std::trace::EntryPointType::Constructor

Constructor

External

Contract interface entry point

Fully qualified path: snforge_std::trace::EntryPointType::External

External

L1Handler

An entrypoint for handling messages from L1

Fully qualified path: snforge_std::trace::EntryPointType::L1Handler

L1Handler

CallType

[source code]

Denotes type of the call

Fully qualified path: snforge_std::trace::CallType

pub enum CallType {
    Call,
    Delegate,
}

Variants

Call

Regular call

Fully qualified path: snforge_std::trace::CallType::Call

Call

Delegate

Library call

Fully qualified path: snforge_std::trace::CallType::Delegate

Delegate

CallResult

[source code]

Result of a contract or a library call

Fully qualified path: snforge_std::trace::CallResult

pub enum CallResult {
    Success: Array<felt252>,
    Failure: CallFailure,
}

Variants

Success

A successful call with it’s result

Fully qualified path: snforge_std::trace::CallResult::Success

Success: Array<felt252>

Failure

A failed call along with it’s panic data

Fully qualified path: snforge_std::trace::CallResult::Failure

Failure: CallFailure

CallFailure

[source code]

Represents a pre-processed failure of a call

Fully qualified path: snforge_std::trace::CallFailure

pub enum CallFailure {
    Panic: Array<felt252>,
    Error: ByteArray,
}

Variants

Panic

Contains raw panic data

Fully qualified path: snforge_std::trace::CallFailure::Panic

Panic: Array<felt252>

Error

Contains panic data in parsed form, if parsing is applicable

Fully qualified path: snforge_std::trace::CallFailure::Error

Error: ByteArray