use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use cosmwasm_std::{to_binary, Addr, CosmosMsg, StdResult, WasmMsg};
use crate::msg::Cw1ExecuteMsg;
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct Cw1Contract(pub Addr);
impl Cw1Contract {
pub fn addr(&self) -> Addr {
self.0.clone()
}
pub fn execute<T: Into<Vec<CosmosMsg>>>(&self, msgs: T) -> StdResult<CosmosMsg> {
let msg = Cw1ExecuteMsg::Execute { msgs: msgs.into() };
Ok(WasmMsg::Execute {
contract_addr: self.addr().into(),
msg: to_binary(&msg)?,
send: vec![],
}
.into())
}
}