Skip to main content

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