1use schemars::JsonSchema;
2use serde::{Deserialize, Serialize};
3
4use cosmwasm_std::{to_binary, Addr, CosmosMsg, StdResult, WasmMsg};
5
6use crate::msg::ExecuteMsg;
7
8#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
11pub struct CwTemplateContract(pub Addr);
12
13impl CwTemplateContract {
14 pub fn addr(&self) -> Addr {
15 self.0.clone()
16 }
17
18 pub fn call<T: Into<ExecuteMsg>>(&self, msg: T) -> StdResult<CosmosMsg> {
19 let msg = to_binary(&msg.into())?;
20 Ok(WasmMsg::Execute {
21 contract_addr: self.addr().into(),
22 msg,
23 funds: vec![],
24 }
25 .into())
26 }
27}