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
use clap::{App, Arg, ArgSettings, SubCommand};
pub trait PositionSubCommand {
fn position_subcommands(self) -> Self;
}
impl PositionSubCommand for App<'_, '_> {
fn position_subcommands(self) -> Self {
self.subcommand(
SubCommand::with_name("pos")
.about("position")
.alias("position")
.subcommands(
vec![
SubCommand::with_name("decr").about("decrease liquidity to position")
.args(
&[
Arg::with_name("mint")
.index(1)
.value_name("MINT")
.required(true)
.help("provider the position mint address"),
Arg::with_name("amount_a")
.short("a")
.long("amount_a").value_name("AMOUNT_A").global(true).takes_value(true).default_value("0")
.help("The token amount a"),
Arg::with_name("amount_b")
.short("b")
.long("amount_b").value_name("AMOUNT_B").global(true).takes_value(true).default_value("0")
.help("The token amount b"),
Arg::with_name("slid")
.short("s")
.long("slid").hidden(true).value_name("SLID").global(true).takes_value(true).default_value("0.01")
.help("The slid rate (default 0.01)"),
]
),
SubCommand::with_name("incr").about("increase liquidity to position")
.args(
&[
Arg::with_name("mint")
.index(1)
.value_name("MINT")
.required(true)
.help("provider the position mint address"),
Arg::with_name("amount_a")
.short("a")
.long("amount_a").value_name("AMOUNT_A").global(true).takes_value(true).default_value("0")
.help("The token amount a"),
Arg::with_name("amount_b")
.short("b")
.long("amount_b").value_name("AMOUNT_B").global(true).takes_value(true).default_value("0")
.help("The token amount b"),
Arg::with_name("slid")
.short("s")
.long("slid").hidden(true).value_name("SLID").global(true).takes_value(true).default_value("0.01")
.help("The slid rate (default 0.01)"),
]
),
SubCommand::with_name("open").about("open a new position")
.args(
&[
Arg::with_name("clmmpool")
.index(1).value_name("CLMMPOOL").required(true)
.help("The clmmpool"),
Arg::with_name("tick_lower_index")
.short("l")
.set(ArgSettings::AllowLeadingHyphen)
.value_name("TICK_LOWER_INDEX").required(true)
.help("The tick lower index"),
Arg::with_name("tick_upper_index")
.short("u")
.set(ArgSettings::AllowLeadingHyphen)
.value_name("TICK_UPPER_INDEX").required(true)
.help("The tick upper index"),
]
),
SubCommand::with_name("remove").about("remove a position")
.args(
&[
Arg::with_name("mint")
.index(1)
.value_name("MINT")
.required(true)
.help("provider the position mint address"),
]
),
SubCommand::with_name("info").about("get position info")
.arg(
Arg::with_name("mint")
.index(1)
.value_name("MINT")
.required(true)
.help("provider the position mint address to retreive the position details"),
),
SubCommand::with_name("collect_fee")
.about("position owner to collect the fee the position owned")
.args(
&[
Arg::with_name("mint")
.index(1)
.value_name("MINT")
.required(true)
.help("provider the position mint address"),
]
),
]
)
)
}
}