Context
Sylvia exposes context types to wrap the Deps/DepsMut
,
Env
, and MessageInfo
types received in the contract entrypoints.
Those types are:
InstantiateCtx
(opens in a new tab)ExecCtx
(opens in a new tab)QueryCtx
(opens in a new tab)MigrateCtx
(opens in a new tab)ReplyCtx
(opens in a new tab)SudoCtx
(opens in a new tab)
💡
Use the above context types in contract message methods.
Usage
Example instantiate method:
use sylvia::types::InstantiateCtx;
#[sv::msg(instantiate)]
fn instantiate(&self, ctx: InstantiateCtx, mutable: bool) -> StdResult<Response> {
let InstantiateCtx { deps, env, info } = ctx;
// ...
}