Skip to main content

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