cw_boolean_contract/entry_points/
execute.rs

1pub mod set_value;
2pub mod toggle;
3
4use crate::errors::ContractError;
5use crate::msgs::execute_msg::ExecuteMsg;
6use cosmwasm_std::entry_point;
7use cosmwasm_std::{DepsMut, Env, MessageInfo, Response};
8
9/// Execute entry point.
10/// You may see a list of the execute variants (methods) in [ExecuteMsg](ExecuteMsg)
11#[cfg_attr(not(feature = "library"), entry_point)]
12pub fn execute(
13    deps: DepsMut,
14    env: Env,
15    info: MessageInfo,
16    msg: ExecuteMsg,
17) -> Result<Response, ContractError> {
18    match msg {
19        ExecuteMsg::SetValue { is_true } => set_value::execute(deps, env, info, is_true)?,
20        // Note you can also use opening and closing curly brackets
21        // if you wanna have a whole block of code that does stuff
22        ExecuteMsg::Toggle {} => {
23            // Note we don't need to pass "is_true" in here cuz
24            // we're just going to load and save the opposite value (true/false)
25            toggle::execute(deps, env, info)?
26        }
27    };
28
29    /// MUST REMOVE THIS
30    Ok(Response::default())
31}