jito_restaking_cli/vault.rs
1use std::path::PathBuf;
2
3use clap::{command, Subcommand};
4use solana_program::pubkey::Pubkey;
5
6#[derive(Subcommand)]
7pub enum VaultCommands {
8 Config {
9 #[command(subcommand)]
10 action: ConfigActions,
11 },
12 Vault {
13 #[command(subcommand)]
14 action: VaultActions,
15 },
16}
17
18#[derive(Subcommand)]
19pub enum ConfigActions {
20 /// Creates global config (can only be done once)
21 Initialize {
22 /// The program fee in basis points
23 program_fee_bps: u16,
24 /// The program fee wallet pubkey
25 program_fee_wallet: Pubkey,
26 },
27 /// Fetches global config
28 Get,
29 /// Set the config admin
30 SetAdmin {
31 /// The new admin's pubkey
32 new_admin: Pubkey,
33 },
34 /// Set the program fee
35 SetProgramFee {
36 /// The program fee
37 new_fee_bps: u16,
38 },
39 /// Set the program fee wallet
40 SetProgramFeeWallet {
41 /// The program fee wallet
42 program_fee_wallet: Pubkey,
43 },
44}
45
46/// Vault commands
47#[derive(Subcommand)]
48pub enum VaultActions {
49 /// Creates a new vault
50 Initialize {
51 /// The token which is allowed to be deposited into the vault
52 token_mint: String,
53 /// The deposit fee in bips
54 deposit_fee_bps: u16,
55 /// The withdrawal fee in bips
56 withdrawal_fee_bps: u16,
57 /// The reward fee in bips
58 reward_fee_bps: u16,
59 /// The decimals of the token
60 decimals: u8,
61 /// The amount of tokens to initialize the vault with ( in the smallest unit )
62 initialize_token_amount: u64,
63 /// The file path of VRT mint address
64 vrt_mint_address_file_path: Option<PathBuf>,
65 },
66 /// Creates token metadata for the vault's LRT token
67 CreateTokenMetadata {
68 /// The vault pubkey
69 vault: String,
70 /// The name of the token
71 name: String,
72 /// The symbol of the token
73 symbol: String,
74 /// The URI for the token metadata
75 uri: String,
76 },
77 UpdateTokenMetadata {
78 /// The vault pubkey
79 vault: String,
80 /// The name of the token
81 name: String,
82 /// The symbol of the token
83 symbol: String,
84 /// The URI for the token metadata
85 uri: String,
86 },
87 /// Starts the vault update cycle
88 InitializeVaultUpdateStateTracker {
89 /// Vault account
90 vault: String,
91 },
92 /// Cranks the vault update state tracker, needs to be run per operator
93 CrankVaultUpdateStateTracker {
94 /// Vault account
95 vault: String,
96 /// Operator account
97 operator: String,
98 },
99 /// Ends the vault update cycle
100 CloseVaultUpdateStateTracker {
101 /// Vault account
102 vault: String,
103 /// Optional NCN epoch to close
104 ncn_epoch: Option<u64>,
105 },
106 /// Mints VRT tokens
107 MintVRT {
108 /// Vault account
109 vault: String,
110 /// Amount to deposit
111 amount_in: u64,
112 /// Minimum amount of VRT to mint
113 min_amount_out: u64,
114 },
115 /// Sets up the delegations for an operator
116 InitializeOperatorDelegation {
117 /// Vault account
118 vault: String,
119 /// Operator account
120 operator: String,
121 },
122 /// Delegates tokens to an operator
123 DelegateToOperator {
124 /// Vault account
125 vault: String,
126 /// Operator account
127 operator: String,
128 /// Amount to delegate
129 amount: u64,
130 },
131 /// Cooldown delegation for an operator
132 CooldownOperatorDelegation {
133 /// Vault account
134 vault: String,
135 /// Operator account
136 operator: String,
137 /// Amount to cooldown
138 amount: u64,
139 },
140 /// Initialize Vault NCN Ticket
141 InitializeVaultNcnTicket {
142 /// Vault account
143 vault: String,
144 /// NCN account
145 ncn: String,
146 },
147 /// Warmup Vault NCN Ticket
148 WarmupVaultNcnTicket {
149 /// Vault account
150 vault: String,
151 /// NCN account
152 ncn: String,
153 },
154 /// Cooldown Vault NCN Ticket
155 CooldownVaultNcnTicket {
156 /// Vault account
157 vault: String,
158 /// NCN account
159 ncn: String,
160 },
161 /// Starts the withdrawal process
162 EnqueueWithdrawal {
163 /// Vault account
164 vault: String,
165 /// Amount to withdraw
166 amount: u64,
167 },
168 /// Change withdrawal ticket owner
169 ChangeWithdrawalTicketOwner {
170 /// The vault pubkey
171 vault: Pubkey,
172
173 /// The old ticket owner keypair
174 #[arg(long)]
175 old_ticket_owner_keypair: String,
176
177 /// The new ticket owner pubkey
178 new_ticket_owner: Pubkey,
179 },
180 /// Burns the withdrawal ticket, ending the withdrawal process
181 BurnWithdrawalTicket {
182 /// Vault account
183 vault: String,
184 },
185 /// Gets the update state tracker for a vault
186 GetVaultUpdateStateTracker {
187 /// Vault account
188 vault: String,
189 },
190 /// Gets the operator delegations for a vault
191 GetOperatorDelegations {
192 /// Vault account
193 vault: String,
194 },
195 /// Gets the operator delegation for a vault
196 GetOperatorDelegation {
197 /// Vault account
198 vault: String,
199 /// Operator account
200 operator: String,
201 },
202 GetWithdrawalTicket {
203 /// Vault account
204 vault: String,
205 /// Staker account
206 staker: Option<String>,
207 },
208 /// Gets a vault
209 Get {
210 /// The vault pubkey
211 pubkey: String,
212 },
213 /// List all vaults
214 List,
215 /// Set Admin
216 SetAdmin {
217 /// The Vault pubkey
218 vault: Pubkey,
219
220 /// Filepath or URL to a keypair of old admin
221 #[arg(long)]
222 old_admin_keypair: String,
223
224 /// Filepath or URL to a keypair of new admin
225 #[arg(long)]
226 new_admin_keypair: String,
227 },
228 /// Sets the deposit capacity in the vault
229 SetCapacity {
230 /// The vault pubkey
231 vault: String,
232 /// The new capacity
233 amount: u64,
234 },
235 /// Sets the fees in the vault
236 SetFees {
237 /// The vault pubkey
238 vault: Pubkey,
239
240 /// The deposit fee BPS
241 #[arg(long)]
242 deposit_fee_bps: Option<u16>,
243
244 /// The withdrawal fee BPS
245 #[arg(long)]
246 withdrawal_fee_bps: Option<u16>,
247
248 /// The reward fee BPS
249 #[arg(long)]
250 reward_fee_bps: Option<u16>,
251 },
252 /// Sets the vault's pause state
253 SetIsPaused {
254 /// The vault pubkey
255 vault: Pubkey,
256
257 /// Set pause
258 #[arg(long)]
259 set_pause: bool,
260 },
261 /// Set Secondary Admin
262 SetSecondaryAdmin {
263 /// The vault pubkey
264 vault: Pubkey,
265
266 /// The new admin pubkey
267 new_admin: Pubkey,
268
269 /// Set delegation_admin
270 #[arg(long)]
271 set_delegation_admin: bool,
272
273 /// Set operator_admin
274 #[arg(long)]
275 set_operator_admin: bool,
276
277 /// Set ncn_admin
278 #[arg(long)]
279 set_ncn_admin: bool,
280
281 /// Set slasher_admin
282 #[arg(long)]
283 set_slasher_admin: bool,
284
285 /// Set capacity_admin
286 #[arg(long)]
287 set_capacity_admin: bool,
288
289 /// Set fee_wallet
290 #[arg(long)]
291 set_fee_wallet: bool,
292
293 /// Set mint_burn_admin
294 #[arg(long)]
295 set_mint_burn_admin: bool,
296
297 /// Set delegate_asset_admin
298 #[arg(long)]
299 set_delegate_asset_admin: bool,
300
301 /// Set fee_admin
302 #[arg(long)]
303 set_fee_admin: bool,
304
305 /// Set metadata_admin
306 #[arg(long)]
307 set_metadata_admin: bool,
308 },
309 /// Update Vault Balance
310 UpdateVaultBalance {
311 /// The vault pubkey
312 vault: Pubkey,
313 },
314 /// Delegate a token account
315 DelegateTokenAccount {
316 /// The vault pubkey
317 vault: String,
318 /// The delegate account
319 delegate: String,
320 /// The token mint
321 token_mint: String,
322 /// The token account
323 token_account: String,
324 },
325 /// Transfer a token account
326 DelegatedTokenTransfer {
327 /// The token account
328 token_account: String,
329 /// The recipient pubkey
330 recipient_pubkey: String,
331 /// The amount to transfer
332 amount: u64,
333 },
334}