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