sg_whitelist/helpers/
interface.rs

1use schemars::JsonSchema;
2use serde::{Deserialize, Serialize};
3
4use cosmwasm_std::{to_json_binary, Addr, StdResult, WasmMsg};
5use sg_std::CosmosMsg;
6
7use crate::msg::ExecuteMsg;
8
9/// CwTemplateContract is a wrapper around Addr that provides a lot of helpers
10/// for working with this.
11#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
12pub struct CollectionWhitelistContract(pub Addr);
13
14impl CollectionWhitelistContract {
15    pub fn addr(&self) -> Addr {
16        self.0.clone()
17    }
18
19    pub fn call<T: Into<ExecuteMsg>>(&self, msg: T) -> StdResult<CosmosMsg> {
20        let msg = to_json_binary(&msg.into())?;
21        Ok(WasmMsg::Execute {
22            contract_addr: self.addr().into(),
23            msg,
24            funds: vec![],
25        }
26        .into())
27    }
28}