Skip to main content

satrush_client/generated/instructions/
settle_deploy_public.rs

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