cw_boolean_contract/entry_points/query/get_value.rs
1use crate::state::CONFIG;
2use cosmwasm_std::{Binary, Deps, Env, StdError, StdResult};
3use mod_sdk::types::QueryResponse;
4
5/// Logic for the [GetValue](crate::msgs::query_msg::QueryMsg::GetValue) (`get_value`) method
6pub fn query(deps: Deps, _env: Env) -> StdResult<QueryResponse> {
7 // Set our state variable according to the input
8 let config = CONFIG.load(deps.storage);
9
10 match config {
11 Ok(c) => Ok(QueryResponse {
12 result: c.is_true,
13 data: Binary::default(),
14 }),
15 Err(_) => Err(StdError::generic_err(
16 "Could not load config which has the boolean",
17 )),
18 }
19}