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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
use clap::{App, SubCommand};
use clap::Arg;
pub trait PairSubCommands {
fn pair_subcommands(self) -> Self;
}
impl PairSubCommands for App<'_, '_> {
fn pair_subcommands(self) -> Self {
self.subcommand(
SubCommand::with_name("pair")
.about("swap pair")
.alias("pair")
//.arg(App)
.subcommands(
vec![
SubCommand::with_name("accept_protocol_fee_authority")
.about("recalled by the new `ClmmConfig` authority to accept the authority")
.arg(
Arg::with_name("clmm_config")
.index(1)
.value_name("CLMM_CONFIG")
.required(true)
.help("The clmm_config is the config of new_authority to accept"),
),
SubCommand::with_name("collect_partner_fee")
.about("collect the partner fee from ata controlled by partner pda")
.args(
&[
Arg::with_name("partner")
.index(1).value_name("PARTNER").required(true)
.help("The partner"),
Arg::with_name("clmmpool")
.index(2).value_name("CLMMPOOL").required(true)
.help("The clmmpool"),
]
),
SubCommand::with_name("collect_protocol_fee")
.about("`protocol_fee_claim_authority` to collect the fee earn by the `clmmpool`")
.arg(
Arg::with_name("clmmpool")
.index(1).value_name("CLMMPOOL").required(true)
.help("The clmmpool"),
),
SubCommand::with_name("create-pool-template")
.about("create a json template for the create-pool")
.arg(
Arg::with_name("output-file")
.index(1)
.value_name("OUTPUT_FILE")
.help("The config file output path (default: ./clmmpool-template.yaml)"),
),
SubCommand::with_name("create-pool")
.about("create a clmm_pool")
.arg(
Arg::with_name("entry_file")
.index(1)
.value_name("ENTRY_FILE")
.help("The config file entry path (default: ./clmmpool-template.yaml)"),
),
SubCommand::with_name("info")
.about("get clmm_pool info")
.arg(
Arg::with_name("pool")
.index(1)
.value_name("pool address")
.required(true)
.help("pool address to retrive"),
),
SubCommand::with_name("ticks").about("TODO"),
SubCommand::with_name("create-config-template")
.about("create a json template for the create-config")
.arg(
Arg::with_name("output-file")
.index(1)
.value_name("OUTPUT_FILE")
.help("The config file output path (default: ./clmm-config-template.yaml)"),
),
SubCommand::with_name("create-config")
.about("create clmm_config")
.arg(
Arg::with_name("entry_file")
.index(1)
.value_name("ENTRY_FILE")
.help("The config file entry path (default: ./clmm-config-template.yaml)"),
),
SubCommand::with_name("config-info")
.about("get config_info")
.arg(
Arg::with_name("config_key")
.index(1)
.value_name("CONFIG_KEY")
.help("The config key"),
),
SubCommand::with_name("create-fee-tier-template")
.about("create a json template for the create-fee-tier")
.arg(
Arg::with_name("output-file")
.index(1)
.value_name("OUTPUT_FILE")
.help("The config file output path (default: ./fee-tier-template.yaml)"),
),
SubCommand::with_name("create-fee-tier")
.about("create fee tier")
.arg(
Arg::with_name("entry_file")
.index(1)
.value_name("ENTRY_FILE")
.help("The config file entry path (default: ./fee-tier-template.yaml)"),
),
SubCommand::with_name("fee-tier-info")
.about("get fee_tier_info")
.arg(
Arg::with_name("fee_tier_key")
.index(1)
.value_name("FEE_TIER_KEY")
.help("The fee_tier key"),
),
SubCommand::with_name("create-partner-template")
.about("create a json template for the create-partner")
.arg(
Arg::with_name("output-file")
.index(1)
.value_name("OUTPUT_FILE")
.help("The config file output path (default: ./partner-template.yaml)"),
),
SubCommand::with_name("create-partner")
.about("create partner")
.arg(
Arg::with_name("entry_file")
.index(1)
.value_name("ENTRY_FILE")
.help("The config file entry path (default: ./partner-template.yaml)"),
),
SubCommand::with_name("partner-info")
.about("get partner_info")
.arg(
Arg::with_name("partner_key")
.index(1)
.value_name("PARTNER_KEY")
.help("The partner key"),
),
SubCommand::with_name("create-tick-array-template")
.about("create a json template for the create-tick-array")
.arg(
Arg::with_name("output-file")
.index(1)
.value_name("OUTPUT_FILE")
.help("The config file output path (default: ./tick-array-template.yaml)"),
),
SubCommand::with_name("create-tick-array")
.about("create tick array")
.arg(
Arg::with_name("entry_file")
.index(1)
.value_name("ENTRY_FILE")
.help("The config file entry path (default: ./tick-array-template.yaml)"),
),
SubCommand::with_name("transfer_protocol_fee_authority")
.about("`protocol_fee_authority` of the `ClmmConfig` to another new authority")
.args(
&[
Arg::with_name("clmm_config")
.index(1)
.value_name("CLMM_CONFIG")
.required(true)
.help("The clmm_config to transfer to new_authority"),
Arg::with_name("new_authority")
.index(2)
.value_name("NEW_AUTHORITY")
.required(true)
.help("The new_authority will be the new authority of clmm_config"),
],
),
SubCommand::with_name("update_config_protocol_fee_rate")
.about("update the `protocol_fee_rate` on `ClmmConfig`")
.args(
&[
Arg::with_name("clmm_config")
.index(1)
.value_name("CLMM_CONFIG")
.required(true)
.help("protocol_fee_authority is the authority to update protocol_fee_rate"),
Arg::with_name("new_protocol_fee_rate")
.index(2)
.value_name("NEW_PROTOCOL_FEE_RATE")
.required(true)
.help("The new_protocol_fee_rate to update protocol config"),
],
),
SubCommand::with_name("update_fee_rate")
.about("update the fee_rate on the `clmmpool`")
.args(
&[
Arg::with_name("fee_tier")
.index(1)
.value_name("FEE_TIER")
.required(true)
.help("The fee_rate ot this fee_tier to update clmmpool"),
Arg::with_name("clmmpool")
.index(2)
.value_name("Clmmpool")
.required(true)
.help("The clmmpool to update the fee_rate"),
],
),
SubCommand::with_name("update_partner")
.about("update partner fee_rate or claim authority")
.args(
&[
Arg::with_name("partner")
.index(1)
.value_name("PARTNER")
.required(true)
.help("partner is the existed partner to update"),
Arg::with_name("new_fee_rate")
.index(2)
.value_name("NEW_FEE_RATE")
.required(true)
.help("The new fee rate to update partner"),
Arg::with_name("new_claim_authority")
.index(3)
.value_name("NEW_CLAIM_AUTHORITY")
.required(true)
.help("The new claim authority to update partner"),
],
),
SubCommand::with_name("update_protocol_fee_rate")
.about("update the `protocol_fee_rate` on `ClmmPool`")
.arg(
Arg::with_name("clmmpool")
.index(1)
.value_name("Clmmpool")
.required(true)
.help("The clmmpool to update the fee_rate"),
),
SubCommand::with_name("swap")
.about("swap")
.args(
&[
Arg::with_name("clmmpool")
.index(1).value_name("CLMMPOOL").required(true)
.help("The clmmpool"),
Arg::with_name("amount")
.index(2).value_name("AMOUNT").required(true)
.help("swap amount"),
Arg::with_name("a_to_b")
.short("d")
.long("a_to_b").value_name("A_TO_B").global(true).takes_value(true).default_value("true")
.help("is a to b (bool)"),
Arg::with_name("by_amount_in")
.short("i")
.long("by_amount_in").value_name("BY_AMOUNT_IN").global(true).takes_value(true).default_value("true")
.help("the amount is in or not"),
Arg::with_name("price_limit_tick")
.short("p")
.long("price_limit_tick").value_name("PRICE_LIMIT_TICK").global(true).takes_value(true)
.help("price_limit_tick"),
]
),
]
)
)
}
}