[][src]Macro cosmwasm_std::create_entry_points

macro_rules! create_entry_points {
    (@migration; $contract:ident, true) => { ... };
    (@migration; $contract:ident, false) => { ... };
    (@inner; $contract:ident, migration = $migration:tt) => { ... };
    ($contract:ident) => { ... };
}

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 init<S: Storage, A: Api, Q: Querier>(
    deps: &mut Extern<S, A, Q>,
    env: Env,
    msg: InitMsg,
) -> InitResult {
}

pub fn handle<S: Storage, A: Api, Q: Querier>(
    deps: &mut Extern<S, A, Q>,
    env: Env,
    msg: HandleMsg,
) -> HandleResult {
}

pub fn query<S: Storage, A: Api, Q: Querier>(
    deps: &Extern<S, A, Q>,
    msg: QueryMsg,
) -> QueryResult {
}

Where InitMsg, HandleMsg, and QueryMsg are types that implement DeserializeOwned + JsonSchema

Example

This example is not tested
use contract; // The contract module

cosmwasm_std::create_entry_points!(contract);