Macro cosmwasm_std::create_entry_points [−][src]
macro_rules! create_entry_points {
(@ migration ; $contract : ident, true) => { ... };
(@ migration ; $contract : ident, false) => { ... };
(@ inner ; $contract : ident, migration = $migration : tt) => { ... };
($contract : ident) => { ... };
}
create_entry_points and create_entry_points_with_migration should be replaces by the #[entry_point] macro as shown in https://github.com/CosmWasm/cosmwasm/blob/main/MIGRATING.md#013—014. They’ll be removed before the final 1.0.0 release. Sorry for the short notice.
Expand description
This macro generates the boilerplate required to call into the contract-specific logic from the entry-points to the Wasm module.
It should be invoked in a module scope(that is, not inside a function), and the argument to the macro should be the name of a second rust module that is imported in the invocation scope. The second module should export three functions with the following signatures:
pub fn instantiate(
deps: DepsMut,
env: Env,
info: MessageInfo,
msg: InstantiateMsg,
) -> Result<Response, StdError> {
}
pub fn execute(
deps: DepsMut,
env: Env,
info: MessageInfo,
msg: ExecuteMsg,
) -> Result<Response, StdError> {
}
pub fn query(
deps: Deps,
env: Env,
msg: QueryMsg,
) -> Result<QueryResponse, StdError> {
}
where InstantiateMsg
, ExecuteMsg
, and QueryMsg
are types that implement DeserializeOwned + JsonSchema
.
Example
use contract; // The contract module
cosmwasm_std::create_entry_points!(contract);