cw_boolean_contract/entry_points/
instantiate.rs

1use crate::errors::ContractError;
2use crate::msgs::instantiate_msg::InstantiateMsg;
3use crate::state::{Config, CONFIG};
4use crate::{CONTRACT_NAME, CONTRACT_VERSION};
5use cosmwasm_std::entry_point;
6use cosmwasm_std::{DepsMut, Env, MessageInfo, Response};
7use cw2::set_contract_version;
8
9/// Instantiate entry point
10/// See the instantiate message and fields in [InstantiateMsg](InstantiateMsg)
11#[cfg_attr(not(feature = "library"), entry_point)]
12pub fn instantiate(
13    deps: DepsMut,
14    _env: Env,
15    _info: MessageInfo,
16    _first_param: Option<InstantiateMsg>,
17) -> Result<Response, ContractError> {
18    // Set the contract version
19    set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?;
20    // Need to explicitly set the state storage, which is just is_true basically
21    CONFIG.save(deps.storage, &Config { is_true: false })?;
22    Ok(Response::default())
23}