1use cosmwasm_schema::cw_serde;
2use cosmwasm_std::{Coin, CosmosMsg, CustomMsg};
3
4#[cw_serde]
6pub enum TerraMsg {
7 Swap {
9 offer_coin: Coin,
10 ask_denom: String
11 },
12 SwapSend {
14 to_address: String,
15 offer_coin: Coin,
16 ask_denom: String
17 }
18}
19
20impl TerraMsg {
21
22 pub fn create_swap_msg(offer_coin: Coin, ask_denom: String) -> Self {
24 TerraMsg::Swap {
25 offer_coin,
26 ask_denom,
27 }
28 }
29
30 pub fn create_swap_send_msg(to_address: String, offer_coin: Coin, ask_denom: String) -> Self {
32 TerraMsg::SwapSend {
33 to_address,
34 offer_coin,
35 ask_denom,
36 }
37 }
38}
39
40impl From<TerraMsg> for CosmosMsg<TerraMsg> {
41 fn from(msg: TerraMsg) -> CosmosMsg<TerraMsg> {
42 CosmosMsg::Custom(msg)
43 }
44}
45
46impl CustomMsg for TerraMsg {}