1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
use crate::route::StargazeRoute;
use cosmwasm_schema::cw_serde;
use cosmwasm_std::{Coin, CosmosMsg, CustomMsg};
static MSG_DATA_VERSION: &str = "1.0.0";
#[cw_serde]
pub struct StargazeMsgWrapper {
pub route: StargazeRoute,
pub msg_data: StargazeMsg,
pub version: String,
}
impl From<StargazeMsgWrapper> for CosmosMsg<StargazeMsgWrapper> {
fn from(original: StargazeMsgWrapper) -> Self {
CosmosMsg::Custom(original)
}
}
impl CustomMsg for StargazeMsgWrapper {}
#[cw_serde]
pub enum StargazeMsg {
ClaimFor {
address: String,
action: ClaimAction,
},
FundCommunityPool {
amount: Vec<Coin>,
},
FundFairburnPool {
amount: Vec<Coin>,
},
}
#[cw_serde]
pub enum ClaimAction {
#[serde(rename = "mint_nft")]
MintNFT,
#[serde(rename = "bid_nft")]
BidNFT,
}
pub fn create_claim_for_msg(address: String, action: ClaimAction) -> CosmosMsg<StargazeMsgWrapper> {
StargazeMsgWrapper {
route: StargazeRoute::Claim,
msg_data: StargazeMsg::ClaimFor { address, action },
version: MSG_DATA_VERSION.to_owned(),
}
.into()
}
pub fn create_fund_community_pool_msg(amount: Vec<Coin>) -> CosmosMsg<StargazeMsgWrapper> {
StargazeMsgWrapper {
route: StargazeRoute::Distribution,
msg_data: StargazeMsg::FundCommunityPool { amount },
version: MSG_DATA_VERSION.to_owned(),
}
.into()
}
pub fn create_fund_fairburn_pool_msg(amount: Vec<Coin>) -> CosmosMsg<StargazeMsgWrapper> {
StargazeMsgWrapper {
route: StargazeRoute::Alloc,
msg_data: StargazeMsg::FundFairburnPool { amount },
version: MSG_DATA_VERSION.to_owned(),
}
.into()
}