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