Skip to main content

satrush_client/generated/instructions/
withdraw_protocol_fees.rs

1//! This code was AUTOGENERATED using the codama library.
2//! Please DO NOT EDIT THIS FILE, instead use visitors
3//! to add features, then rerun codama to update it.
4//!
5//! <https://github.com/codama-idl/codama>
6//!
7
8use borsh::BorshSerialize;
9use borsh::BorshDeserialize;
10
11pub const WITHDRAW_PROTOCOL_FEES_DISCRIMINATOR: [u8; 8] = [11, 68, 165, 98, 18, 208, 134, 73];
12
13/// Accounts.
14#[derive(Debug)]
15pub struct WithdrawProtocolFees {
16      
17              
18          pub authority: solana_address::Address,
19          
20              
21          pub satrush_config: solana_address::Address,
22                /// The treasury: owns the fee pool and signs the withdrawal transfer.
23
24    
25              
26          pub treasury: solana_address::Address,
27          
28              
29          pub usd_mint: solana_address::Address,
30                /// Treasury's USD fee pool — the withdrawal source.
31
32    
33              
34          pub treasury_usd_ata: solana_address::Address,
35          
36              
37          pub btc_mint: solana_address::Address,
38                /// Treasury's BTC pool — swept no-winner round pots. Created lazily: the
39/// treasury predates the BTC side, so the ATA may not exist yet.
40
41    
42              
43          pub treasury_btc_ata: solana_address::Address,
44                /// as the authority of the destination ATA.
45
46    
47              
48          pub fee_recipient: solana_address::Address,
49                /// Fee recipient's USD account — the withdrawal destination. Created by the
50/// crank if missing.
51
52    
53              
54          pub fee_recipient_usd_ata: solana_address::Address,
55                /// Fee recipient's BTC account — the BTC withdrawal destination. Created by
56/// the crank if missing.
57
58    
59              
60          pub fee_recipient_btc_ata: solana_address::Address,
61          
62              
63          pub token_program: solana_address::Address,
64          
65              
66          pub associated_token_program: solana_address::Address,
67          
68              
69          pub system_program: solana_address::Address,
70      }
71
72impl WithdrawProtocolFees {
73  pub fn instruction(&self) -> solana_instruction::Instruction {
74    self.instruction_with_remaining_accounts(&[])
75  }
76  #[allow(clippy::arithmetic_side_effects)]
77  #[allow(clippy::vec_init_then_push)]
78  pub fn instruction_with_remaining_accounts(&self, remaining_accounts: &[solana_instruction::AccountMeta]) -> solana_instruction::Instruction {
79    let mut accounts = Vec::with_capacity(13+ remaining_accounts.len());
80                            accounts.push(solana_instruction::AccountMeta::new(
81            self.authority,
82            true
83          ));
84                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
85            self.satrush_config,
86            false
87          ));
88                                          accounts.push(solana_instruction::AccountMeta::new(
89            self.treasury,
90            false
91          ));
92                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
93            self.usd_mint,
94            false
95          ));
96                                          accounts.push(solana_instruction::AccountMeta::new(
97            self.treasury_usd_ata,
98            false
99          ));
100                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
101            self.btc_mint,
102            false
103          ));
104                                          accounts.push(solana_instruction::AccountMeta::new(
105            self.treasury_btc_ata,
106            false
107          ));
108                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
109            self.fee_recipient,
110            false
111          ));
112                                          accounts.push(solana_instruction::AccountMeta::new(
113            self.fee_recipient_usd_ata,
114            false
115          ));
116                                          accounts.push(solana_instruction::AccountMeta::new(
117            self.fee_recipient_btc_ata,
118            false
119          ));
120                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
121            self.token_program,
122            false
123          ));
124                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
125            self.associated_token_program,
126            false
127          ));
128                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
129            self.system_program,
130            false
131          ));
132                      accounts.extend_from_slice(remaining_accounts);
133    let data = WithdrawProtocolFeesInstructionData::new().try_to_vec().unwrap();
134    
135    solana_instruction::Instruction {
136      program_id: crate::SATRUSH_ID,
137      accounts,
138      data,
139    }
140  }
141}
142
143#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
144 pub struct WithdrawProtocolFeesInstructionData {
145            discriminator: [u8; 8],
146      }
147
148impl WithdrawProtocolFeesInstructionData {
149  pub fn new() -> Self {
150    Self {
151                        discriminator: [11, 68, 165, 98, 18, 208, 134, 73],
152                  }
153  }
154
155    pub(crate) fn try_to_vec(&self) -> Result<Vec<u8>, std::io::Error> {
156    borsh::to_vec(self)
157  }
158  }
159
160impl Default for WithdrawProtocolFeesInstructionData {
161  fn default() -> Self {
162    Self::new()
163  }
164}
165
166
167
168/// Instruction builder for `WithdrawProtocolFees`.
169///
170/// ### Accounts:
171///
172                      ///   0. `[writable, signer]` authority
173          ///   1. `[]` satrush_config
174                ///   2. `[writable]` treasury
175          ///   3. `[]` usd_mint
176                ///   4. `[writable]` treasury_usd_ata
177          ///   5. `[]` btc_mint
178                ///   6. `[writable]` treasury_btc_ata
179          ///   7. `[]` fee_recipient
180                ///   8. `[writable]` fee_recipient_usd_ata
181                ///   9. `[writable]` fee_recipient_btc_ata
182                ///   10. `[optional]` token_program (default to `TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA`)
183                ///   11. `[optional]` associated_token_program (default to `ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL`)
184                ///   12. `[optional]` system_program (default to `11111111111111111111111111111111`)
185#[derive(Clone, Debug, Default)]
186pub struct WithdrawProtocolFeesBuilder {
187            authority: Option<solana_address::Address>,
188                satrush_config: Option<solana_address::Address>,
189                treasury: Option<solana_address::Address>,
190                usd_mint: Option<solana_address::Address>,
191                treasury_usd_ata: Option<solana_address::Address>,
192                btc_mint: Option<solana_address::Address>,
193                treasury_btc_ata: Option<solana_address::Address>,
194                fee_recipient: Option<solana_address::Address>,
195                fee_recipient_usd_ata: Option<solana_address::Address>,
196                fee_recipient_btc_ata: Option<solana_address::Address>,
197                token_program: Option<solana_address::Address>,
198                associated_token_program: Option<solana_address::Address>,
199                system_program: Option<solana_address::Address>,
200                __remaining_accounts: Vec<solana_instruction::AccountMeta>,
201}
202
203impl WithdrawProtocolFeesBuilder {
204  pub fn new() -> Self {
205    Self::default()
206  }
207            #[inline(always)]
208    pub fn authority(&mut self, authority: solana_address::Address) -> &mut Self {
209                        self.authority = Some(authority);
210                    self
211    }
212            #[inline(always)]
213    pub fn satrush_config(&mut self, satrush_config: solana_address::Address) -> &mut Self {
214                        self.satrush_config = Some(satrush_config);
215                    self
216    }
217            /// The treasury: owns the fee pool and signs the withdrawal transfer.
218#[inline(always)]
219    pub fn treasury(&mut self, treasury: solana_address::Address) -> &mut Self {
220                        self.treasury = Some(treasury);
221                    self
222    }
223            #[inline(always)]
224    pub fn usd_mint(&mut self, usd_mint: solana_address::Address) -> &mut Self {
225                        self.usd_mint = Some(usd_mint);
226                    self
227    }
228            /// Treasury's USD fee pool — the withdrawal source.
229#[inline(always)]
230    pub fn treasury_usd_ata(&mut self, treasury_usd_ata: solana_address::Address) -> &mut Self {
231                        self.treasury_usd_ata = Some(treasury_usd_ata);
232                    self
233    }
234            #[inline(always)]
235    pub fn btc_mint(&mut self, btc_mint: solana_address::Address) -> &mut Self {
236                        self.btc_mint = Some(btc_mint);
237                    self
238    }
239            /// Treasury's BTC pool — swept no-winner round pots. Created lazily: the
240/// treasury predates the BTC side, so the ATA may not exist yet.
241#[inline(always)]
242    pub fn treasury_btc_ata(&mut self, treasury_btc_ata: solana_address::Address) -> &mut Self {
243                        self.treasury_btc_ata = Some(treasury_btc_ata);
244                    self
245    }
246            /// as the authority of the destination ATA.
247#[inline(always)]
248    pub fn fee_recipient(&mut self, fee_recipient: solana_address::Address) -> &mut Self {
249                        self.fee_recipient = Some(fee_recipient);
250                    self
251    }
252            /// Fee recipient's USD account — the withdrawal destination. Created by the
253/// crank if missing.
254#[inline(always)]
255    pub fn fee_recipient_usd_ata(&mut self, fee_recipient_usd_ata: solana_address::Address) -> &mut Self {
256                        self.fee_recipient_usd_ata = Some(fee_recipient_usd_ata);
257                    self
258    }
259            /// Fee recipient's BTC account — the BTC withdrawal destination. Created by
260/// the crank if missing.
261#[inline(always)]
262    pub fn fee_recipient_btc_ata(&mut self, fee_recipient_btc_ata: solana_address::Address) -> &mut Self {
263                        self.fee_recipient_btc_ata = Some(fee_recipient_btc_ata);
264                    self
265    }
266            /// `[optional account, default to 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA']`
267#[inline(always)]
268    pub fn token_program(&mut self, token_program: solana_address::Address) -> &mut Self {
269                        self.token_program = Some(token_program);
270                    self
271    }
272            /// `[optional account, default to 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL']`
273#[inline(always)]
274    pub fn associated_token_program(&mut self, associated_token_program: solana_address::Address) -> &mut Self {
275                        self.associated_token_program = Some(associated_token_program);
276                    self
277    }
278            /// `[optional account, default to '11111111111111111111111111111111']`
279#[inline(always)]
280    pub fn system_program(&mut self, system_program: solana_address::Address) -> &mut Self {
281                        self.system_program = Some(system_program);
282                    self
283    }
284            /// Add an additional account to the instruction.
285  #[inline(always)]
286  pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self {
287    self.__remaining_accounts.push(account);
288    self
289  }
290  /// Add additional accounts to the instruction.
291  #[inline(always)]
292  pub fn add_remaining_accounts(&mut self, accounts: &[solana_instruction::AccountMeta]) -> &mut Self {
293    self.__remaining_accounts.extend_from_slice(accounts);
294    self
295  }
296  #[allow(clippy::clone_on_copy)]
297  pub fn instruction(&self) -> solana_instruction::Instruction {
298    let accounts = WithdrawProtocolFees {
299                              authority: self.authority.expect("authority is not set"),
300                                        satrush_config: self.satrush_config.expect("satrush_config is not set"),
301                                        treasury: self.treasury.expect("treasury is not set"),
302                                        usd_mint: self.usd_mint.expect("usd_mint is not set"),
303                                        treasury_usd_ata: self.treasury_usd_ata.expect("treasury_usd_ata is not set"),
304                                        btc_mint: self.btc_mint.expect("btc_mint is not set"),
305                                        treasury_btc_ata: self.treasury_btc_ata.expect("treasury_btc_ata is not set"),
306                                        fee_recipient: self.fee_recipient.expect("fee_recipient is not set"),
307                                        fee_recipient_usd_ata: self.fee_recipient_usd_ata.expect("fee_recipient_usd_ata is not set"),
308                                        fee_recipient_btc_ata: self.fee_recipient_btc_ata.expect("fee_recipient_btc_ata is not set"),
309                                        token_program: self.token_program.unwrap_or(solana_address::address!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA")),
310                                        associated_token_program: self.associated_token_program.unwrap_or(solana_address::address!("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL")),
311                                        system_program: self.system_program.unwrap_or(solana_address::address!("11111111111111111111111111111111")),
312                      };
313    
314    accounts.instruction_with_remaining_accounts(&self.__remaining_accounts)
315  }
316}
317
318  /// `withdraw_protocol_fees` CPI accounts.
319  pub struct WithdrawProtocolFeesCpiAccounts<'a, 'b> {
320          
321                    
322              pub authority: &'b solana_account_info::AccountInfo<'a>,
323                
324                    
325              pub satrush_config: &'b solana_account_info::AccountInfo<'a>,
326                        /// The treasury: owns the fee pool and signs the withdrawal transfer.
327
328      
329                    
330              pub treasury: &'b solana_account_info::AccountInfo<'a>,
331                
332                    
333              pub usd_mint: &'b solana_account_info::AccountInfo<'a>,
334                        /// Treasury's USD fee pool — the withdrawal source.
335
336      
337                    
338              pub treasury_usd_ata: &'b solana_account_info::AccountInfo<'a>,
339                
340                    
341              pub btc_mint: &'b solana_account_info::AccountInfo<'a>,
342                        /// Treasury's BTC pool — swept no-winner round pots. Created lazily: the
343/// treasury predates the BTC side, so the ATA may not exist yet.
344
345      
346                    
347              pub treasury_btc_ata: &'b solana_account_info::AccountInfo<'a>,
348                        /// as the authority of the destination ATA.
349
350      
351                    
352              pub fee_recipient: &'b solana_account_info::AccountInfo<'a>,
353                        /// Fee recipient's USD account — the withdrawal destination. Created by the
354/// crank if missing.
355
356      
357                    
358              pub fee_recipient_usd_ata: &'b solana_account_info::AccountInfo<'a>,
359                        /// Fee recipient's BTC account — the BTC withdrawal destination. Created by
360/// the crank if missing.
361
362      
363                    
364              pub fee_recipient_btc_ata: &'b solana_account_info::AccountInfo<'a>,
365                
366                    
367              pub token_program: &'b solana_account_info::AccountInfo<'a>,
368                
369                    
370              pub associated_token_program: &'b solana_account_info::AccountInfo<'a>,
371                
372                    
373              pub system_program: &'b solana_account_info::AccountInfo<'a>,
374            }
375
376/// `withdraw_protocol_fees` CPI instruction.
377pub struct WithdrawProtocolFeesCpi<'a, 'b> {
378  /// The program to invoke.
379  pub __program: &'b solana_account_info::AccountInfo<'a>,
380      
381              
382          pub authority: &'b solana_account_info::AccountInfo<'a>,
383          
384              
385          pub satrush_config: &'b solana_account_info::AccountInfo<'a>,
386                /// The treasury: owns the fee pool and signs the withdrawal transfer.
387
388    
389              
390          pub treasury: &'b solana_account_info::AccountInfo<'a>,
391          
392              
393          pub usd_mint: &'b solana_account_info::AccountInfo<'a>,
394                /// Treasury's USD fee pool — the withdrawal source.
395
396    
397              
398          pub treasury_usd_ata: &'b solana_account_info::AccountInfo<'a>,
399          
400              
401          pub btc_mint: &'b solana_account_info::AccountInfo<'a>,
402                /// Treasury's BTC pool — swept no-winner round pots. Created lazily: the
403/// treasury predates the BTC side, so the ATA may not exist yet.
404
405    
406              
407          pub treasury_btc_ata: &'b solana_account_info::AccountInfo<'a>,
408                /// as the authority of the destination ATA.
409
410    
411              
412          pub fee_recipient: &'b solana_account_info::AccountInfo<'a>,
413                /// Fee recipient's USD account — the withdrawal destination. Created by the
414/// crank if missing.
415
416    
417              
418          pub fee_recipient_usd_ata: &'b solana_account_info::AccountInfo<'a>,
419                /// Fee recipient's BTC account — the BTC withdrawal destination. Created by
420/// the crank if missing.
421
422    
423              
424          pub fee_recipient_btc_ata: &'b solana_account_info::AccountInfo<'a>,
425          
426              
427          pub token_program: &'b solana_account_info::AccountInfo<'a>,
428          
429              
430          pub associated_token_program: &'b solana_account_info::AccountInfo<'a>,
431          
432              
433          pub system_program: &'b solana_account_info::AccountInfo<'a>,
434        }
435
436impl<'a, 'b> WithdrawProtocolFeesCpi<'a, 'b> {
437  pub fn new(
438    program: &'b solana_account_info::AccountInfo<'a>,
439          accounts: WithdrawProtocolFeesCpiAccounts<'a, 'b>,
440          ) -> Self {
441    Self {
442      __program: program,
443              authority: accounts.authority,
444              satrush_config: accounts.satrush_config,
445              treasury: accounts.treasury,
446              usd_mint: accounts.usd_mint,
447              treasury_usd_ata: accounts.treasury_usd_ata,
448              btc_mint: accounts.btc_mint,
449              treasury_btc_ata: accounts.treasury_btc_ata,
450              fee_recipient: accounts.fee_recipient,
451              fee_recipient_usd_ata: accounts.fee_recipient_usd_ata,
452              fee_recipient_btc_ata: accounts.fee_recipient_btc_ata,
453              token_program: accounts.token_program,
454              associated_token_program: accounts.associated_token_program,
455              system_program: accounts.system_program,
456                }
457  }
458  #[inline(always)]
459  pub fn invoke(&self) -> solana_program_error::ProgramResult {
460    self.invoke_signed_with_remaining_accounts(&[], &[])
461  }
462  #[inline(always)]
463  pub fn invoke_with_remaining_accounts(&self, remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)]) -> solana_program_error::ProgramResult {
464    self.invoke_signed_with_remaining_accounts(&[], remaining_accounts)
465  }
466  #[inline(always)]
467  pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult {
468    self.invoke_signed_with_remaining_accounts(signers_seeds, &[])
469  }
470  #[allow(clippy::arithmetic_side_effects)]
471  #[allow(clippy::clone_on_copy)]
472  #[allow(clippy::vec_init_then_push)]
473  pub fn invoke_signed_with_remaining_accounts(
474    &self,
475    signers_seeds: &[&[&[u8]]],
476    remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)]
477  ) -> solana_program_error::ProgramResult {
478    let mut accounts = Vec::with_capacity(13+ remaining_accounts.len());
479                            accounts.push(solana_instruction::AccountMeta::new(
480            *self.authority.key,
481            true
482          ));
483                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
484            *self.satrush_config.key,
485            false
486          ));
487                                          accounts.push(solana_instruction::AccountMeta::new(
488            *self.treasury.key,
489            false
490          ));
491                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
492            *self.usd_mint.key,
493            false
494          ));
495                                          accounts.push(solana_instruction::AccountMeta::new(
496            *self.treasury_usd_ata.key,
497            false
498          ));
499                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
500            *self.btc_mint.key,
501            false
502          ));
503                                          accounts.push(solana_instruction::AccountMeta::new(
504            *self.treasury_btc_ata.key,
505            false
506          ));
507                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
508            *self.fee_recipient.key,
509            false
510          ));
511                                          accounts.push(solana_instruction::AccountMeta::new(
512            *self.fee_recipient_usd_ata.key,
513            false
514          ));
515                                          accounts.push(solana_instruction::AccountMeta::new(
516            *self.fee_recipient_btc_ata.key,
517            false
518          ));
519                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
520            *self.token_program.key,
521            false
522          ));
523                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
524            *self.associated_token_program.key,
525            false
526          ));
527                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
528            *self.system_program.key,
529            false
530          ));
531                      remaining_accounts.iter().for_each(|remaining_account| {
532      accounts.push(solana_instruction::AccountMeta {
533          pubkey: *remaining_account.0.key,
534          is_signer: remaining_account.1,
535          is_writable: remaining_account.2,
536      })
537    });
538    let data = WithdrawProtocolFeesInstructionData::new().try_to_vec().unwrap();
539    
540    let instruction = solana_instruction::Instruction {
541      program_id: crate::SATRUSH_ID,
542      accounts,
543      data,
544    };
545    let mut account_infos = Vec::with_capacity(14 + remaining_accounts.len());
546    account_infos.push(self.__program.clone());
547                  account_infos.push(self.authority.clone());
548                        account_infos.push(self.satrush_config.clone());
549                        account_infos.push(self.treasury.clone());
550                        account_infos.push(self.usd_mint.clone());
551                        account_infos.push(self.treasury_usd_ata.clone());
552                        account_infos.push(self.btc_mint.clone());
553                        account_infos.push(self.treasury_btc_ata.clone());
554                        account_infos.push(self.fee_recipient.clone());
555                        account_infos.push(self.fee_recipient_usd_ata.clone());
556                        account_infos.push(self.fee_recipient_btc_ata.clone());
557                        account_infos.push(self.token_program.clone());
558                        account_infos.push(self.associated_token_program.clone());
559                        account_infos.push(self.system_program.clone());
560              remaining_accounts.iter().for_each(|remaining_account| account_infos.push(remaining_account.0.clone()));
561
562    if signers_seeds.is_empty() {
563      solana_cpi::invoke(&instruction, &account_infos)
564    } else {
565      solana_cpi::invoke_signed(&instruction, &account_infos, signers_seeds)
566    }
567  }
568}
569
570/// Instruction builder for `WithdrawProtocolFees` via CPI.
571///
572/// ### Accounts:
573///
574                      ///   0. `[writable, signer]` authority
575          ///   1. `[]` satrush_config
576                ///   2. `[writable]` treasury
577          ///   3. `[]` usd_mint
578                ///   4. `[writable]` treasury_usd_ata
579          ///   5. `[]` btc_mint
580                ///   6. `[writable]` treasury_btc_ata
581          ///   7. `[]` fee_recipient
582                ///   8. `[writable]` fee_recipient_usd_ata
583                ///   9. `[writable]` fee_recipient_btc_ata
584          ///   10. `[]` token_program
585          ///   11. `[]` associated_token_program
586          ///   12. `[]` system_program
587#[derive(Clone, Debug)]
588pub struct WithdrawProtocolFeesCpiBuilder<'a, 'b> {
589  instruction: Box<WithdrawProtocolFeesCpiBuilderInstruction<'a, 'b>>,
590}
591
592impl<'a, 'b> WithdrawProtocolFeesCpiBuilder<'a, 'b> {
593  pub fn new(program: &'b solana_account_info::AccountInfo<'a>) -> Self {
594    let instruction = Box::new(WithdrawProtocolFeesCpiBuilderInstruction {
595      __program: program,
596              authority: None,
597              satrush_config: None,
598              treasury: None,
599              usd_mint: None,
600              treasury_usd_ata: None,
601              btc_mint: None,
602              treasury_btc_ata: None,
603              fee_recipient: None,
604              fee_recipient_usd_ata: None,
605              fee_recipient_btc_ata: None,
606              token_program: None,
607              associated_token_program: None,
608              system_program: None,
609                                __remaining_accounts: Vec::new(),
610    });
611    Self { instruction }
612  }
613      #[inline(always)]
614    pub fn authority(&mut self, authority: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
615                        self.instruction.authority = Some(authority);
616                    self
617    }
618      #[inline(always)]
619    pub fn satrush_config(&mut self, satrush_config: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
620                        self.instruction.satrush_config = Some(satrush_config);
621                    self
622    }
623      /// The treasury: owns the fee pool and signs the withdrawal transfer.
624#[inline(always)]
625    pub fn treasury(&mut self, treasury: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
626                        self.instruction.treasury = Some(treasury);
627                    self
628    }
629      #[inline(always)]
630    pub fn usd_mint(&mut self, usd_mint: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
631                        self.instruction.usd_mint = Some(usd_mint);
632                    self
633    }
634      /// Treasury's USD fee pool — the withdrawal source.
635#[inline(always)]
636    pub fn treasury_usd_ata(&mut self, treasury_usd_ata: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
637                        self.instruction.treasury_usd_ata = Some(treasury_usd_ata);
638                    self
639    }
640      #[inline(always)]
641    pub fn btc_mint(&mut self, btc_mint: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
642                        self.instruction.btc_mint = Some(btc_mint);
643                    self
644    }
645      /// Treasury's BTC pool — swept no-winner round pots. Created lazily: the
646/// treasury predates the BTC side, so the ATA may not exist yet.
647#[inline(always)]
648    pub fn treasury_btc_ata(&mut self, treasury_btc_ata: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
649                        self.instruction.treasury_btc_ata = Some(treasury_btc_ata);
650                    self
651    }
652      /// as the authority of the destination ATA.
653#[inline(always)]
654    pub fn fee_recipient(&mut self, fee_recipient: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
655                        self.instruction.fee_recipient = Some(fee_recipient);
656                    self
657    }
658      /// Fee recipient's USD account — the withdrawal destination. Created by the
659/// crank if missing.
660#[inline(always)]
661    pub fn fee_recipient_usd_ata(&mut self, fee_recipient_usd_ata: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
662                        self.instruction.fee_recipient_usd_ata = Some(fee_recipient_usd_ata);
663                    self
664    }
665      /// Fee recipient's BTC account — the BTC withdrawal destination. Created by
666/// the crank if missing.
667#[inline(always)]
668    pub fn fee_recipient_btc_ata(&mut self, fee_recipient_btc_ata: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
669                        self.instruction.fee_recipient_btc_ata = Some(fee_recipient_btc_ata);
670                    self
671    }
672      #[inline(always)]
673    pub fn token_program(&mut self, token_program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
674                        self.instruction.token_program = Some(token_program);
675                    self
676    }
677      #[inline(always)]
678    pub fn associated_token_program(&mut self, associated_token_program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
679                        self.instruction.associated_token_program = Some(associated_token_program);
680                    self
681    }
682      #[inline(always)]
683    pub fn system_program(&mut self, system_program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
684                        self.instruction.system_program = Some(system_program);
685                    self
686    }
687            /// Add an additional account to the instruction.
688  #[inline(always)]
689  pub fn add_remaining_account(&mut self, account: &'b solana_account_info::AccountInfo<'a>, is_writable: bool, is_signer: bool) -> &mut Self {
690    self.instruction.__remaining_accounts.push((account, is_writable, is_signer));
691    self
692  }
693  /// Add additional accounts to the instruction.
694  ///
695  /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not,
696  /// and a `bool` indicating whether the account is a signer or not.
697  #[inline(always)]
698  pub fn add_remaining_accounts(&mut self, accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)]) -> &mut Self {
699    self.instruction.__remaining_accounts.extend_from_slice(accounts);
700    self
701  }
702  #[inline(always)]
703  pub fn invoke(&self) -> solana_program_error::ProgramResult {
704    self.invoke_signed(&[])
705  }
706  #[allow(clippy::clone_on_copy)]
707  #[allow(clippy::vec_init_then_push)]
708  pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult {
709        let instruction = WithdrawProtocolFeesCpi {
710        __program: self.instruction.__program,
711                  
712          authority: self.instruction.authority.expect("authority is not set"),
713                  
714          satrush_config: self.instruction.satrush_config.expect("satrush_config is not set"),
715                  
716          treasury: self.instruction.treasury.expect("treasury is not set"),
717                  
718          usd_mint: self.instruction.usd_mint.expect("usd_mint is not set"),
719                  
720          treasury_usd_ata: self.instruction.treasury_usd_ata.expect("treasury_usd_ata is not set"),
721                  
722          btc_mint: self.instruction.btc_mint.expect("btc_mint is not set"),
723                  
724          treasury_btc_ata: self.instruction.treasury_btc_ata.expect("treasury_btc_ata is not set"),
725                  
726          fee_recipient: self.instruction.fee_recipient.expect("fee_recipient is not set"),
727                  
728          fee_recipient_usd_ata: self.instruction.fee_recipient_usd_ata.expect("fee_recipient_usd_ata is not set"),
729                  
730          fee_recipient_btc_ata: self.instruction.fee_recipient_btc_ata.expect("fee_recipient_btc_ata is not set"),
731                  
732          token_program: self.instruction.token_program.expect("token_program is not set"),
733                  
734          associated_token_program: self.instruction.associated_token_program.expect("associated_token_program is not set"),
735                  
736          system_program: self.instruction.system_program.expect("system_program is not set"),
737                    };
738    instruction.invoke_signed_with_remaining_accounts(signers_seeds, &self.instruction.__remaining_accounts)
739  }
740}
741
742#[derive(Clone, Debug)]
743struct WithdrawProtocolFeesCpiBuilderInstruction<'a, 'b> {
744  __program: &'b solana_account_info::AccountInfo<'a>,
745            authority: Option<&'b solana_account_info::AccountInfo<'a>>,
746                satrush_config: Option<&'b solana_account_info::AccountInfo<'a>>,
747                treasury: Option<&'b solana_account_info::AccountInfo<'a>>,
748                usd_mint: Option<&'b solana_account_info::AccountInfo<'a>>,
749                treasury_usd_ata: Option<&'b solana_account_info::AccountInfo<'a>>,
750                btc_mint: Option<&'b solana_account_info::AccountInfo<'a>>,
751                treasury_btc_ata: Option<&'b solana_account_info::AccountInfo<'a>>,
752                fee_recipient: Option<&'b solana_account_info::AccountInfo<'a>>,
753                fee_recipient_usd_ata: Option<&'b solana_account_info::AccountInfo<'a>>,
754                fee_recipient_btc_ata: Option<&'b solana_account_info::AccountInfo<'a>>,
755                token_program: Option<&'b solana_account_info::AccountInfo<'a>>,
756                associated_token_program: Option<&'b solana_account_info::AccountInfo<'a>>,
757                system_program: Option<&'b solana_account_info::AccountInfo<'a>>,
758                /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`.
759  __remaining_accounts: Vec<(&'b solana_account_info::AccountInfo<'a>, bool, bool)>,
760}
761