Skip to main content

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