Trait abstract_cw_multi_test::Module

source ·
pub trait Module {
    type ExecT;
    type QueryT;
    type SudoT;

    // Required methods
    fn execute<ExecC, QueryC>(
        &self,
        api: &dyn Api,
        storage: &mut dyn Storage,
        router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>,
        block: &BlockInfo,
        sender: Addr,
        msg: Self::ExecT
    ) -> AnyResult<AppResponse>
       where ExecC: CustomMsg + DeserializeOwned + 'static,
             QueryC: CustomQuery + DeserializeOwned + 'static;
    fn query(
        &self,
        api: &dyn Api,
        storage: &dyn Storage,
        querier: &dyn Querier,
        block: &BlockInfo,
        request: Self::QueryT
    ) -> AnyResult<Binary>;
    fn sudo<ExecC, QueryC>(
        &self,
        api: &dyn Api,
        storage: &mut dyn Storage,
        router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>,
        block: &BlockInfo,
        msg: Self::SudoT
    ) -> AnyResult<AppResponse>
       where ExecC: CustomMsg + DeserializeOwned + 'static,
             QueryC: CustomQuery + DeserializeOwned + 'static;

    // Provided methods
    fn ibc_channel_open<ExecC, QueryC>(
        &self,
        _api: &dyn Api,
        _storage: &mut dyn Storage,
        _router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>,
        _block: &BlockInfo,
        _request: IbcChannelOpenMsg
    ) -> AnyResult<IbcChannelOpenResponse> { ... }
    fn ibc_channel_connect<ExecC, QueryC>(
        &self,
        _api: &dyn Api,
        _storage: &mut dyn Storage,
        _router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>,
        _block: &BlockInfo,
        _request: IbcChannelConnectMsg
    ) -> AnyResult<AppIbcBasicResponse> { ... }
    fn ibc_channel_close<ExecC, QueryC>(
        &self,
        _api: &dyn Api,
        _storage: &mut dyn Storage,
        _router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>,
        _block: &BlockInfo,
        _request: IbcChannelCloseMsg
    ) -> AnyResult<AppIbcBasicResponse> { ... }
    fn ibc_packet_receive<ExecC, QueryC>(
        &self,
        _api: &dyn Api,
        _storage: &mut dyn Storage,
        _router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>,
        _block: &BlockInfo,
        _request: IbcPacketReceiveMsg
    ) -> AnyResult<AppIbcReceiveResponse> { ... }
    fn ibc_packet_acknowledge<ExecC, QueryC>(
        &self,
        _api: &dyn Api,
        _storage: &mut dyn Storage,
        _router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>,
        _block: &BlockInfo,
        _request: IbcPacketAckMsg
    ) -> AnyResult<AppIbcBasicResponse> { ... }
    fn ibc_packet_timeout<ExecC, QueryC>(
        &self,
        _api: &dyn Api,
        _storage: &mut dyn Storage,
        _router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>,
        _block: &BlockInfo,
        _request: IbcPacketTimeoutMsg
    ) -> AnyResult<AppIbcBasicResponse> { ... }
}
Expand description

§General module

Provides a generic interface for modules within the test environment. It is essential for creating modular and extensible testing setups, allowing developers to integrate custom functionalities or test specific scenarios.

Required Associated Types§

source

type ExecT

Type of messages processed by the module instance.

source

type QueryT

Type of queries processed by the module instance.

source

type SudoT

Type of privileged messages used by the module instance.

Required Methods§

source

fn execute<ExecC, QueryC>( &self, api: &dyn Api, storage: &mut dyn Storage, router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>, block: &BlockInfo, sender: Addr, msg: Self::ExecT ) -> AnyResult<AppResponse>
where ExecC: CustomMsg + DeserializeOwned + 'static, QueryC: CustomQuery + DeserializeOwned + 'static,

Runs any ExecT message, which can be called by any external actor or smart contract.

source

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

Runs any QueryT message, which can be called by any external actor or smart contract.

source

fn sudo<ExecC, QueryC>( &self, api: &dyn Api, storage: &mut dyn Storage, router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>, block: &BlockInfo, msg: Self::SudoT ) -> AnyResult<AppResponse>
where ExecC: CustomMsg + DeserializeOwned + 'static, QueryC: CustomQuery + DeserializeOwned + 'static,

Runs privileged actions, like minting tokens, or governance proposals. This allows modules to have full access to these privileged actions, that cannot be triggered by smart contracts.

There is no sender, as this must be previously authorized before calling.

Provided Methods§

source

fn ibc_channel_open<ExecC, QueryC>( &self, _api: &dyn Api, _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<ExecC, QueryC>( &self, _api: &dyn Api, _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<ExecC, QueryC>( &self, _api: &dyn Api, _storage: &mut dyn Storage, _router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>, _block: &BlockInfo, _request: IbcChannelCloseMsg ) -> AnyResult<AppIbcBasicResponse>

Executes the contract ibc_channel_close endpoints

source

fn ibc_packet_receive<ExecC, QueryC>( &self, _api: &dyn Api, _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<ExecC, QueryC>( &self, _api: &dyn Api, _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<ExecC, QueryC>( &self, _api: &dyn Api, _storage: &mut dyn Storage, _router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>, _block: &BlockInfo, _request: IbcPacketTimeoutMsg ) -> AnyResult<AppIbcBasicResponse>

Executes the contract ibc_packet_timeout endpoint

Object Safety§

This trait is not object safe.

Implementors§

source§

impl Module for IbcSimpleModule

source§

impl Module for BankKeeper

source§

impl Module for DistributionKeeper

source§

impl Module for StakeKeeper

source§

impl<Exec, Query> Module for CachingCustomHandler<Exec, Query>

§

type ExecT = Exec

§

type QueryT = Query

§

type SudoT = Empty

source§

impl<ExecT, QueryT, SudoT> Module for AcceptingModule<ExecT, QueryT, SudoT>
where ExecT: Debug, QueryT: Debug, SudoT: Debug,

§

type ExecT = ExecT

§

type QueryT = QueryT

§

type SudoT = SudoT

source§

impl<ExecT, QueryT, SudoT> Module for FailingModule<ExecT, QueryT, SudoT>
where ExecT: Debug, QueryT: Debug, SudoT: Debug,

§

type ExecT = ExecT

§

type QueryT = QueryT

§

type SudoT = SudoT