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