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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
use crate::state::Config;
use cosmwasm_schema::{cw_serde, QueryResponses};
use cosmwasm_std::{Binary, Decimal, Uint128};
use cw20::Cw20ReceiveMsg;
use komple_framework_types::modules::fee::Fees;
use komple_framework_types::shared::execute::SharedExecuteMsg;
use komple_framework_types::shared::query::ResponseWrapper;
#[cw_serde]
pub enum ExecuteMsg {
SetFee {
fee_type: Fees,
module_name: String,
fee_name: String,
data: Binary,
},
RemoveFee {
fee_type: Fees,
module_name: String,
fee_name: String,
},
Distribute {
fee_type: Fees,
module_name: String,
custom_payment_addresses: Option<Vec<CustomPaymentAddress>>,
},
LockExecute {},
Receive(Cw20ReceiveMsg),
}
impl From<ExecuteMsg> for SharedExecuteMsg {
fn from(msg: ExecuteMsg) -> Self {
match msg {
ExecuteMsg::LockExecute {} => SharedExecuteMsg::LockExecute {},
_ => unreachable!("Cannot convert {:?} to SharedExecuteMessage", msg),
}
}
}
#[cw_serde]
pub enum ReceiveMsg {
Distribute {
fee_type: Fees,
module_name: String,
custom_payment_addresses: Option<Vec<CustomPaymentAddress>>,
},
}
#[cw_serde]
#[derive(QueryResponses)]
pub enum QueryMsg {
#[returns(ResponseWrapper<Config>)]
Config {},
#[returns(ResponseWrapper<PercentageFeeResponse>)]
PercentageFee {
module_name: String,
fee_name: String,
},
#[returns(ResponseWrapper<FixedFeeResponse>)]
FixedFee {
module_name: String,
fee_name: String,
},
#[returns(ResponseWrapper<Vec<PercentageFeeResponse>>)]
PercentageFees {
module_name: String,
start_after: Option<String>,
limit: Option<u32>,
},
#[returns(ResponseWrapper<Vec<FixedFeeResponse>>)]
FixedFees {
module_name: String,
start_after: Option<String>,
limit: Option<u32>,
},
#[returns(ResponseWrapper<Decimal>)]
TotalPercentageFees {
module_name: String,
start_after: Option<String>,
limit: Option<u32>,
},
#[returns(ResponseWrapper<Uint128>)]
TotalFixedFees {
module_name: String,
start_after: Option<String>,
limit: Option<u32>,
},
#[returns(ResponseWrapper<Vec<String>>)]
Keys {
fee_type: Fees,
start_after: Option<String>,
limit: Option<u32>,
},
}
#[cw_serde]
pub struct PercentageFeeResponse {
pub module_name: String,
pub fee_name: String,
pub address: Option<String>,
pub value: Decimal,
}
#[cw_serde]
pub struct FixedFeeResponse {
pub module_name: String,
pub fee_name: String,
pub address: Option<String>,
pub value: Uint128,
}
#[cw_serde]
pub struct CustomPaymentAddress {
pub fee_name: String,
pub address: String,
}