Skip to main content

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