Trait abstract_cw_multi_test::Wasm

source ·
pub trait Wasm<ExecC, QueryC> {
Show 17 methods // Required methods fn execute( &self, api: &dyn Api, storage: &mut dyn Storage, router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>, block: &BlockInfo, sender: Addr, msg: WasmMsg ) -> AnyResult<AppResponse>; fn query( &self, api: &dyn Api, storage: &dyn Storage, querier: &dyn Querier, block: &BlockInfo, request: WasmQuery ) -> AnyResult<Binary>; fn sudo( &self, api: &dyn Api, storage: &mut dyn Storage, router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>, block: &BlockInfo, msg: WasmSudo ) -> AnyResult<AppResponse>; fn store_code( &mut self, creator: Addr, code: Box<dyn Contract<ExecC, QueryC>> ) -> u64; fn store_code_with_id( &mut self, creator: Addr, code_id: u64, code: Box<dyn Contract<ExecC, QueryC>> ) -> AnyResult<u64>; fn duplicate_code(&mut self, code_id: u64) -> AnyResult<u64>; fn contract_data( &self, storage: &dyn Storage, address: &Addr ) -> AnyResult<ContractData>; fn dump_wasm_raw( &self, storage: &dyn Storage, address: &Addr ) -> Vec<Record>; // Provided methods fn contract_namespace(&self, contract: &Addr) -> Vec<u8> { ... } fn contract_storage<'a>( &self, storage: &'a dyn Storage, address: &Addr ) -> Box<dyn Storage + 'a> { ... } fn contract_storage_mut<'a>( &self, storage: &'a mut dyn Storage, address: &Addr ) -> Box<dyn Storage + 'a> { ... } fn ibc_channel_open( &self, _api: &dyn Api, _contract_addr: Addr, _storage: &mut dyn Storage, _router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>, _block: &BlockInfo, _request: IbcChannelOpenMsg ) -> AnyResult<IbcChannelOpenResponse> { ... } fn ibc_channel_connect( &self, _api: &dyn Api, _contract_addr: Addr, _storage: &mut dyn Storage, _router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>, _block: &BlockInfo, _request: IbcChannelConnectMsg ) -> AnyResult<AppIbcBasicResponse> { ... } fn ibc_channel_close( &self, _api: &dyn Api, _contract_addr: Addr, _storage: &mut dyn Storage, _router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>, _block: &BlockInfo, _request: IbcChannelCloseMsg ) -> AnyResult<AppIbcBasicResponse> { ... } fn ibc_packet_receive( &self, _api: &dyn Api, _contract_addr: Addr, _storage: &mut dyn Storage, _router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>, _block: &BlockInfo, _request: IbcPacketReceiveMsg ) -> AnyResult<AppIbcReceiveResponse> { ... } fn ibc_packet_acknowledge( &self, _api: &dyn Api, _contract_addr: Addr, _storage: &mut dyn Storage, _router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>, _block: &BlockInfo, _request: IbcPacketAckMsg ) -> AnyResult<AppIbcBasicResponse> { ... } fn ibc_packet_timeout( &self, _api: &dyn Api, _contract_addr: Addr, _storage: &mut dyn Storage, _router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>, _block: &BlockInfo, _request: IbcPacketTimeoutMsg ) -> AnyResult<AppIbcBasicResponse> { ... }
}
Expand description

Acts as the interface for interacting with WebAssembly (Wasm) modules. This trait is crucial for testing smart contracts written in languages that compile to WebAssembly, which is common in the Cosmos and CosmWasm ecosystems.

Required Methods§

source

fn execute( &self, api: &dyn Api, storage: &mut dyn Storage, router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>, block: &BlockInfo, sender: Addr, msg: WasmMsg ) -> AnyResult<AppResponse>

Handles all WasmMsg messages.

source

fn query( &self, api: &dyn Api, storage: &dyn Storage, querier: &dyn Querier, block: &BlockInfo, request: WasmQuery ) -> AnyResult<Binary>

Handles all WasmQuery requests.

source

fn sudo( &self, api: &dyn Api, storage: &mut dyn Storage, router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>, block: &BlockInfo, msg: WasmSudo ) -> AnyResult<AppResponse>

Handles all sudo messages, this is an admin interface and can not be called via CosmosMsg.

source

fn store_code( &mut self, creator: Addr, code: Box<dyn Contract<ExecC, QueryC>> ) -> u64

Stores the contract’s code and returns an identifier of the stored contract’s code.

source

fn store_code_with_id( &mut self, creator: Addr, code_id: u64, code: Box<dyn Contract<ExecC, QueryC>> ) -> AnyResult<u64>

Stores the contract’s code under specified identifier, returns the same code identifier when successful.

source

fn duplicate_code(&mut self, code_id: u64) -> AnyResult<u64>

Duplicates the contract’s code with specified identifier and returns an identifier of the copy of the contract’s code.

source

fn contract_data( &self, storage: &dyn Storage, address: &Addr ) -> AnyResult<ContractData>

Returns ContractData for the contract with specified address.

source

fn dump_wasm_raw(&self, storage: &dyn Storage, address: &Addr) -> Vec<Record>

Returns a raw state dump of all key-values held by a contract with specified address.

Provided Methods§

source

fn contract_namespace(&self, contract: &Addr) -> Vec<u8>

Returns the namespace of the contract storage.

source

fn contract_storage<'a>( &self, storage: &'a dyn Storage, address: &Addr ) -> Box<dyn Storage + 'a>

Returns read-only (not mutable) contract storage.

source

fn contract_storage_mut<'a>( &self, storage: &'a mut dyn Storage, address: &Addr ) -> Box<dyn Storage + 'a>

Returns read-write (mutable) contract storage.

source

fn ibc_channel_open( &self, _api: &dyn Api, _contract_addr: Addr, _storage: &mut dyn Storage, _router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>, _block: &BlockInfo, _request: IbcChannelOpenMsg ) -> AnyResult<IbcChannelOpenResponse>

Executes the contract ibc_channel_open endpoint

source

fn ibc_channel_connect( &self, _api: &dyn Api, _contract_addr: Addr, _storage: &mut dyn Storage, _router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>, _block: &BlockInfo, _request: IbcChannelConnectMsg ) -> AnyResult<AppIbcBasicResponse>

Executes the contract ibc_channel_connect endpoint

source

fn ibc_channel_close( &self, _api: &dyn Api, _contract_addr: Addr, _storage: &mut dyn Storage, _router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>, _block: &BlockInfo, _request: IbcChannelCloseMsg ) -> AnyResult<AppIbcBasicResponse>

Executes the contract ibc_channel_close endpoint

source

fn ibc_packet_receive( &self, _api: &dyn Api, _contract_addr: Addr, _storage: &mut dyn Storage, _router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>, _block: &BlockInfo, _request: IbcPacketReceiveMsg ) -> AnyResult<AppIbcReceiveResponse>

Executes the contract ibc_packet_receive endpoint

source

fn ibc_packet_acknowledge( &self, _api: &dyn Api, _contract_addr: Addr, _storage: &mut dyn Storage, _router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>, _block: &BlockInfo, _request: IbcPacketAckMsg ) -> AnyResult<AppIbcBasicResponse>

Executes the contract ibc_packet_acknowledge endpoint

source

fn ibc_packet_timeout( &self, _api: &dyn Api, _contract_addr: Addr, _storage: &mut dyn Storage, _router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>, _block: &BlockInfo, _request: IbcPacketTimeoutMsg ) -> AnyResult<AppIbcBasicResponse>

Executes the contract ibc_packet_timeout endpoint

Implementors§

source§

impl<ExecC, QueryC> Wasm<ExecC, QueryC> for WasmKeeper<ExecC, QueryC>
where ExecC: CustomMsg + DeserializeOwned + 'static, QueryC: CustomQuery + DeserializeOwned + 'static,