whitelist_mtree/helpers/
interface.rs

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