Macro fadroma::entrypoint

source ·
macro_rules! entrypoint {
    (@init $($init:ident)::+) => { ... };
    (@execute $($execute:ident)::+) => { ... };
    (@query $($query:ident)::+) => { ... };
    (@reply $($reply:ident)::+) => { ... };
    (@wasm_mod $($contents:tt)*) => { ... };
    (
        init: $($init:ident)::+,
        execute: $($execute:ident)::+,
        query: $($query:ident)::+
        $(, reply: $($reply:ident)::+)?
    ) => { ... };
}
Expand description

Define the mod wasm entrypoint for production builds, using the provided entry point functions.

Supports init, execute and query or init, execute, query and reply.

Note that Fadroma DSL already handles this for you and as such this macro is not needed when using it.

Examples

pub fn instantiate(
    _deps: DepsMut,
    _env: Env,
    _info: MessageInfo,
    _msg: InitMsg
) -> StdResult<Response> {
    Ok(Response::default())
}

pub fn execute(
    _deps: DepsMut,
    _env: Env,
    _info: MessageInfo,
    _msg: ExecuteMsg
) -> StdResult<Response> {
    Ok(Response::default())
}

pub fn query(
    _deps: Deps,
    _env: Env,
    _msg: QueryMsg
) -> StdResult<Binary> {
    to_binary(&true)
}
 
entrypoint! {
    init: instantiate,
    execute: execute,
    query: query
}