/
msg.rs
109 lines (102 loc) · 2.54 KB
/
msg.rs
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
use cosmwasm_schema::{cw_serde, QueryResponses};
use cosmwasm_std::{Uint64, Coin, Addr, Decimal};
use fee_splitter::Share;
use crate::state::Listing;
#[cw_serde]
pub struct InstantiateMsg {
pub admin: String,
pub fee_percentage: Decimal,
pub shares: Vec<Share>,
}
#[cw_serde]
pub enum ExecuteMsg {
CreateListing {
denom: String,
number_of_credits: Uint64,
price_per_credit: Coin,
operator: Option<Addr>,
},
UpdateListing {
denom: String,
number_of_credits: Uint64,
price_per_credit: Coin,
},
BuyCredits {
owner: Addr,
denom: String,
number_of_credits_to_buy: u64,
retire: bool,
retiring_entity_name: Option<String>,
retiring_entity_additional_data: Option<String>,
},
CancelListing {
denom: String,
},
FreezeCredits {
owner: Addr,
denom: String,
number_of_credits_to_freeze: u64,
buyer: Addr,
timeout_unix_timestamp: u64,
},
CancelFrozenCredits {
owner: Addr,
denom: String,
number_of_frozen_credits_to_cancel: u64, // 0 means all
buyer: Addr,
},
ReleaseFrozenCredits {
owner: Addr,
denom: String,
number_of_credits_to_release: u64,
buyer: Addr,
retire: bool,
retiring_entity_name: Option<String>,
retiring_entity_additional_data: Option<String>,
},
EditFeeSplitConfig {
fee_percentage: Decimal,
shares: Vec<Share>
},
}
#[cw_serde]
#[derive(QueryResponses)]
pub enum QueryMsg {
#[returns(ListingsResponse)]
Listings {
/// The maximum number of listings to return as part of this
/// query. If no limit is set a max of 30 listings will be
/// returned.
limit: Option<u64>,
/// The address of the listing to start the query after. If
/// this is set, the listing with this address will not be
/// included in the results.
start_after: Option<(Addr, String)>,
},
#[returns(ListingResponse)]
Listing {
owner: Addr,
denom: String,
},
#[returns(fee_splitter::Config)]
FeeSplitConfig {},
#[returns(PriceResponse)]
Price {
owner: Addr,
denom: String,
number_of_credits_to_buy: u64,
},
}
#[cw_serde]
pub struct ListingsResponse {
pub listings: Vec<Listing>,
}
#[cw_serde]
pub struct ListingResponse {
pub listing: Listing,
}
#[cw_serde]
pub struct PriceResponse {
pub total_price: Coin,
pub fee: Coin,
}