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
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("liquidity")
.short("l")
.long("liquidity").value_name("LIQUIDITY").global(true).takes_value(true).default_value("0")
.help("The liquidity"),
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("incr-fixed").about("increase liquidity with fixed token to position")
.args(
&[
Arg::with_name("mint")
.index(1)
.value_name("MINT")
.required(true)
.help("provider the position mint address"),
Arg::with_name("amount")
.short("a")
.long("amount").value_name("AMOUNT").takes_value(true).required(true)
.help("The token amount fixed"),
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)"),
Arg::with_name("is_a_fixed")
.short("f")
.long("fixed")
.value_name("IS_A_FIXED")
.global(true)
.takes_value(true)
.default_value("true")
.help("a or b is fixed"),
]
),
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("list").about("get position list")
.args(
&[
Arg::with_name("clmmpool")
.short("p")
.long("clmmpool").value_name("CLMMPOOL").global(true).takes_value(true)
.help("The clmm pool address"),
Arg::with_name("auth")
.short("a")
.long("auth").value_name("AUTH").global(true).takes_value(true)
.help("The user owner address"),
]
),
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"),
]
),
SubCommand::with_name("collect-rewarder")
.about("collect rewarder")
.args(
&[
Arg::with_name("mint")
.index(1)
.value_name("MINT")
.required(true)
.help("provider the position mint address"),
Arg::with_name("rewarder_index")
.short("i")
.long("rewarder_index").value_name("REWARDER_INDEX").global(true).takes_value(true)
.help("rewarder index"),
]
),
]
)
)
}
}