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