pub trait Wasm<ExecC, QueryC> {
// 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,
) -> StdResult<AppResponse>;
fn query(
&self,
api: &dyn Api,
storage: &dyn Storage,
querier: &dyn Querier,
block: &BlockInfo,
request: WasmQuery,
) -> StdResult<Binary>;
fn sudo(
&self,
api: &dyn Api,
storage: &mut dyn Storage,
router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>,
block: &BlockInfo,
msg: WasmSudo,
) -> StdResult<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>>,
) -> StdResult<u64>;
fn duplicate_code(&mut self, code_id: u64) -> StdResult<u64>;
fn contract_data(
&self,
storage: &dyn Storage,
address: &Addr,
) -> StdResult<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> { ... }
}
Expand description
This trait implements the interface of the Wasm module.
Required Methods§
Sourcefn execute(
&self,
api: &dyn Api,
storage: &mut dyn Storage,
router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>,
block: &BlockInfo,
sender: Addr,
msg: WasmMsg,
) -> StdResult<AppResponse>
fn execute( &self, api: &dyn Api, storage: &mut dyn Storage, router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>, block: &BlockInfo, sender: Addr, msg: WasmMsg, ) -> StdResult<AppResponse>
Handles all WasmMsg
messages.
Sourcefn query(
&self,
api: &dyn Api,
storage: &dyn Storage,
querier: &dyn Querier,
block: &BlockInfo,
request: WasmQuery,
) -> StdResult<Binary>
fn query( &self, api: &dyn Api, storage: &dyn Storage, querier: &dyn Querier, block: &BlockInfo, request: WasmQuery, ) -> StdResult<Binary>
Handles all WasmQuery
requests.
Sourcefn sudo(
&self,
api: &dyn Api,
storage: &mut dyn Storage,
router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>,
block: &BlockInfo,
msg: WasmSudo,
) -> StdResult<AppResponse>
fn sudo( &self, api: &dyn Api, storage: &mut dyn Storage, router: &dyn CosmosRouter<ExecC = ExecC, QueryC = QueryC>, block: &BlockInfo, msg: WasmSudo, ) -> StdResult<AppResponse>
Handles all sudo messages, this is an admin interface and can not be called via CosmosMsg
.
Sourcefn store_code(
&mut self,
creator: Addr,
code: Box<dyn Contract<ExecC, QueryC>>,
) -> u64
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.
Sourcefn store_code_with_id(
&mut self,
creator: Addr,
code_id: u64,
code: Box<dyn Contract<ExecC, QueryC>>,
) -> StdResult<u64>
fn store_code_with_id( &mut self, creator: Addr, code_id: u64, code: Box<dyn Contract<ExecC, QueryC>>, ) -> StdResult<u64>
Stores the contract’s code under specified identifier, returns the same code identifier when successful.
Sourcefn duplicate_code(&mut self, code_id: u64) -> StdResult<u64>
fn duplicate_code(&mut self, code_id: u64) -> StdResult<u64>
Duplicates the contract’s code with specified identifier and returns an identifier of the copy of the contract’s code.
Sourcefn contract_data(
&self,
storage: &dyn Storage,
address: &Addr,
) -> StdResult<ContractData>
fn contract_data( &self, storage: &dyn Storage, address: &Addr, ) -> StdResult<ContractData>
Returns ContractData
for the contract with specified address.
Provided Methods§
Sourcefn contract_namespace(&self, contract: &Addr) -> Vec<u8> ⓘ
fn contract_namespace(&self, contract: &Addr) -> Vec<u8> ⓘ
Returns the namespace of the contract storage.