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