terp721_base/
lib.rs

1pub mod contract;
2mod error;
3pub mod msg;
4mod state;
5pub mod upgrades;
6
7pub use crate::error::ContractError;
8pub use crate::state::Terp721Contract;
9use cosmwasm_std::Empty;
10use cw721_base::Extension;
11
12pub type ExecuteMsg = terp721::ExecuteMsg<Extension, Empty>;
13pub type QueryMsg = cw721_base::QueryMsg<Empty>;
14
15pub mod entry {
16    use super::*;
17    use crate::{msg::QueryMsg, state::Terp721Contract};
18
19    #[cfg(not(feature = "library"))]
20    use cosmwasm_std::entry_point;
21    use cosmwasm_std::{Binary, Deps, DepsMut, Env, MessageInfo, StdResult};
22    use cw2::set_contract_version;
23    use cw721_base::Extension;
24    use terp721::InstantiateMsg;
25    use terp_sdk::Response;
26
27    // version info for migration info
28    pub const CONTRACT_NAME: &str = "crates.io:terp721-base";
29    pub const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION");
30
31    #[cfg_attr(not(feature = "library"), entry_point)]
32    pub fn instantiate(
33        deps: DepsMut,
34        env: Env,
35        info: MessageInfo,
36        msg: InstantiateMsg,
37    ) -> Result<Response, ContractError> {
38        set_contract_version(deps.storage, CONTRACT_NAME, CONTRACT_VERSION)?;
39
40        let res = Terp721Contract::<Extension>::default().instantiate(deps, env, info, msg)?;
41
42        Ok(res
43            .add_attribute("contract_name", CONTRACT_NAME)
44            .add_attribute("contract_version", CONTRACT_VERSION))
45    }
46
47    #[cfg_attr(not(feature = "library"), entry_point)]
48    pub fn execute(
49        deps: DepsMut,
50        env: Env,
51        info: MessageInfo,
52        msg: ExecuteMsg,
53    ) -> Result<Response, ContractError> {
54        Terp721Contract::<Extension>::default().execute(deps, env, info, msg)
55    }
56
57    #[cfg_attr(not(feature = "library"), entry_point)]
58    pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult<Binary> {
59        Terp721Contract::<Extension>::default().query(deps, env, msg)
60    }
61}