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