komple_framework_fee_module/
msg.rs1use crate::state::Config;
2use cosmwasm_schema::{cw_serde, QueryResponses};
3use cosmwasm_std::{Binary, Decimal, Uint128};
4use cw20::Cw20ReceiveMsg;
5use komple_framework_types::modules::fee::Fees;
6use komple_framework_types::shared::execute::SharedExecuteMsg;
7use komple_framework_types::shared::query::ResponseWrapper;
8
9#[cw_serde]
10pub enum ExecuteMsg {
11 SetFee {
16 fee_type: Fees,
17 module_name: String,
18 fee_name: String,
19 data: Binary,
20 },
21 RemoveFee {
25 fee_type: Fees,
26 module_name: String,
27 fee_name: String,
28 },
29 Distribute {
35 fee_type: Fees,
36 module_name: String,
37 custom_payment_addresses: Option<Vec<CustomPaymentAddress>>,
38 },
39 UpdateOperators {
43 addrs: Vec<String>,
44 },
45 LockExecute {},
50 Receive(Cw20ReceiveMsg),
51}
52
53impl From<ExecuteMsg> for SharedExecuteMsg {
54 fn from(msg: ExecuteMsg) -> Self {
55 match msg {
56 ExecuteMsg::LockExecute {} => SharedExecuteMsg::LockExecute {},
57 _ => unreachable!("Cannot convert {:?} to SharedExecuteMessage", msg),
58 }
59 }
60}
61
62#[cw_serde]
63pub enum ReceiveMsg {
64 Distribute {
65 fee_type: Fees,
66 module_name: String,
67 custom_payment_addresses: Option<Vec<CustomPaymentAddress>>,
68 },
69}
70
71#[cw_serde]
72#[derive(QueryResponses)]
73pub enum QueryMsg {
74 #[returns(ResponseWrapper<Config>)]
76 Config {},
77 #[returns(ResponseWrapper<PercentageFeeResponse>)]
79 PercentageFee {
80 module_name: String,
81 fee_name: String,
82 },
83 #[returns(ResponseWrapper<FixedFeeResponse>)]
85 FixedFee {
86 module_name: String,
87 fee_name: String,
88 },
89 #[returns(ResponseWrapper<Vec<PercentageFeeResponse>>)]
91 PercentageFees {
92 module_name: String,
93 start_after: Option<String>,
94 limit: Option<u32>,
95 },
96 #[returns(ResponseWrapper<Vec<FixedFeeResponse>>)]
98 FixedFees {
99 module_name: String,
100 start_after: Option<String>,
101 limit: Option<u32>,
102 },
103 #[returns(ResponseWrapper<Decimal>)]
105 TotalPercentageFees {
106 module_name: String,
107 start_after: Option<String>,
108 limit: Option<u32>,
109 },
110 #[returns(ResponseWrapper<Uint128>)]
112 TotalFixedFees {
113 module_name: String,
114 start_after: Option<String>,
115 limit: Option<u32>,
116 },
117 #[returns(ResponseWrapper<Vec<String>>)]
119 Keys {
120 fee_type: Fees,
121 start_after: Option<String>,
122 limit: Option<u32>,
123 },
124 #[returns(ResponseWrapper<Vec<String>>)]
126 Operators {},
127}
128
129#[cw_serde]
130pub struct PercentageFeeResponse {
131 pub module_name: String,
132 pub fee_name: String,
133 pub address: Option<String>,
134 pub value: Decimal,
135}
136
137#[cw_serde]
138pub struct FixedFeeResponse {
139 pub module_name: String,
140 pub fee_name: String,
141 pub address: Option<String>,
142 pub value: Uint128,
143}
144
145#[cw_serde]
147pub struct CustomPaymentAddress {
148 pub fee_name: String,
149 pub address: String,
150}