pub trait InitCallback: Serialize {
const BLOCK_SIZE: usize;
// Provided method
fn to_cosmos_msg(
&self,
admin: Option<String>,
label: String,
code_id: u64,
code_hash: String,
funds_amount: Option<Uint128>,
) -> StdResult<CosmosMsg> { ... }
}
Expand description
A trait marking types that define the instantiation message of a contract
This trait requires specifying a padding block size and provides a method to create the CosmosMsg used to instantiate a contract
Required Associated Constants§
Sourceconst BLOCK_SIZE: usize
const BLOCK_SIZE: usize
pad the message to blocks of this size
Provided Methods§
Sourcefn to_cosmos_msg(
&self,
admin: Option<String>,
label: String,
code_id: u64,
code_hash: String,
funds_amount: Option<Uint128>,
) -> StdResult<CosmosMsg>
fn to_cosmos_msg( &self, admin: Option<String>, label: String, code_id: u64, code_hash: String, funds_amount: Option<Uint128>, ) -> StdResult<CosmosMsg>
Returns StdResult
Tries to convert the instance of the implementing type to a CosmosMsg that will trigger the instantiation of a contract. The BLOCK_SIZE specified in the implementation is used when padding the message
§Arguments
label
- String holding the label for the new contract instancecode_id
- code ID of the contract to be instantiatedcode_hash
- String holding the code hash of the contract to be instantiatedfunds_amount
- Optional Uint128 amount of native coin to send with instantiation message
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.