ContractClassTrait

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>,
) -> SyscallResult<(ContractAddress, Span<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,
) -> SyscallResult<(ContractAddress, Span<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