Skip to main content

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