Skip to main content

defituna_staking/generated/instructions/
compound_reward_two_hop.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
11/// Accounts.
12#[derive(Debug)]
13pub struct CompoundRewardTwoHop {
14      
15              
16          pub authority: solana_pubkey::Pubkey,
17          
18              
19          pub treasury: solana_pubkey::Pubkey,
20          
21              
22          pub position: solana_pubkey::Pubkey,
23          
24              
25          pub staked_token_mint: solana_pubkey::Pubkey,
26          
27              
28          pub intermediate_token_mint: solana_pubkey::Pubkey,
29          
30              
31          pub reward_token_mint: solana_pubkey::Pubkey,
32          
33              
34          pub treasury_staked_token_account: solana_pubkey::Pubkey,
35          
36              
37          pub treasury_reward_token_account: solana_pubkey::Pubkey,
38          
39              
40          pub fusionamm_program: solana_pubkey::Pubkey,
41          
42              
43          pub fusion_pool_one: solana_pubkey::Pubkey,
44          
45              
46          pub fusion_pool_two: solana_pubkey::Pubkey,
47          
48              
49          pub token_program: solana_pubkey::Pubkey,
50          
51              
52          pub memo_program: solana_pubkey::Pubkey,
53      }
54
55impl CompoundRewardTwoHop {
56  pub fn instruction(&self) -> solana_instruction::Instruction {
57    self.instruction_with_remaining_accounts(&[])
58  }
59  #[allow(clippy::arithmetic_side_effects)]
60  #[allow(clippy::vec_init_then_push)]
61  pub fn instruction_with_remaining_accounts(&self, remaining_accounts: &[solana_instruction::AccountMeta]) -> solana_instruction::Instruction {
62    let mut accounts = Vec::with_capacity(13+ remaining_accounts.len());
63                            accounts.push(solana_instruction::AccountMeta::new(
64            self.authority,
65            true
66          ));
67                                          accounts.push(solana_instruction::AccountMeta::new(
68            self.treasury,
69            false
70          ));
71                                          accounts.push(solana_instruction::AccountMeta::new(
72            self.position,
73            false
74          ));
75                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
76            self.staked_token_mint,
77            false
78          ));
79                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
80            self.intermediate_token_mint,
81            false
82          ));
83                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
84            self.reward_token_mint,
85            false
86          ));
87                                          accounts.push(solana_instruction::AccountMeta::new(
88            self.treasury_staked_token_account,
89            false
90          ));
91                                          accounts.push(solana_instruction::AccountMeta::new(
92            self.treasury_reward_token_account,
93            false
94          ));
95                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
96            self.fusionamm_program,
97            false
98          ));
99                                          accounts.push(solana_instruction::AccountMeta::new(
100            self.fusion_pool_one,
101            false
102          ));
103                                          accounts.push(solana_instruction::AccountMeta::new(
104            self.fusion_pool_two,
105            false
106          ));
107                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
108            self.token_program,
109            false
110          ));
111                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
112            self.memo_program,
113            false
114          ));
115                      accounts.extend_from_slice(remaining_accounts);
116    let data = borsh::to_vec(&CompoundRewardTwoHopInstructionData::new()).unwrap();
117    
118    solana_instruction::Instruction {
119      program_id: crate::TUNA_STAKING_ID,
120      accounts,
121      data,
122    }
123  }
124}
125
126#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
127#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
128 pub struct CompoundRewardTwoHopInstructionData {
129            discriminator: [u8; 8],
130      }
131
132impl CompoundRewardTwoHopInstructionData {
133  pub fn new() -> Self {
134    Self {
135                        discriminator: [149, 245, 127, 251, 253, 249, 167, 129],
136                  }
137  }
138}
139
140impl Default for CompoundRewardTwoHopInstructionData {
141  fn default() -> Self {
142    Self::new()
143  }
144}
145
146
147
148/// Instruction builder for `CompoundRewardTwoHop`.
149///
150/// ### Accounts:
151///
152                      ///   0. `[writable, signer]` authority
153                ///   1. `[writable]` treasury
154                ///   2. `[writable]` position
155          ///   3. `[]` staked_token_mint
156          ///   4. `[]` intermediate_token_mint
157          ///   5. `[]` reward_token_mint
158                ///   6. `[writable]` treasury_staked_token_account
159                ///   7. `[writable]` treasury_reward_token_account
160          ///   8. `[]` fusionamm_program
161                ///   9. `[writable]` fusion_pool_one
162                ///   10. `[writable]` fusion_pool_two
163                ///   11. `[optional]` token_program (default to `TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA`)
164          ///   12. `[]` memo_program
165#[derive(Clone, Debug, Default)]
166pub struct CompoundRewardTwoHopBuilder {
167            authority: Option<solana_pubkey::Pubkey>,
168                treasury: Option<solana_pubkey::Pubkey>,
169                position: Option<solana_pubkey::Pubkey>,
170                staked_token_mint: Option<solana_pubkey::Pubkey>,
171                intermediate_token_mint: Option<solana_pubkey::Pubkey>,
172                reward_token_mint: Option<solana_pubkey::Pubkey>,
173                treasury_staked_token_account: Option<solana_pubkey::Pubkey>,
174                treasury_reward_token_account: Option<solana_pubkey::Pubkey>,
175                fusionamm_program: Option<solana_pubkey::Pubkey>,
176                fusion_pool_one: Option<solana_pubkey::Pubkey>,
177                fusion_pool_two: Option<solana_pubkey::Pubkey>,
178                token_program: Option<solana_pubkey::Pubkey>,
179                memo_program: Option<solana_pubkey::Pubkey>,
180                __remaining_accounts: Vec<solana_instruction::AccountMeta>,
181}
182
183impl CompoundRewardTwoHopBuilder {
184  pub fn new() -> Self {
185    Self::default()
186  }
187            #[inline(always)]
188    pub fn authority(&mut self, authority: solana_pubkey::Pubkey) -> &mut Self {
189                        self.authority = Some(authority);
190                    self
191    }
192            #[inline(always)]
193    pub fn treasury(&mut self, treasury: solana_pubkey::Pubkey) -> &mut Self {
194                        self.treasury = Some(treasury);
195                    self
196    }
197            #[inline(always)]
198    pub fn position(&mut self, position: solana_pubkey::Pubkey) -> &mut Self {
199                        self.position = Some(position);
200                    self
201    }
202            #[inline(always)]
203    pub fn staked_token_mint(&mut self, staked_token_mint: solana_pubkey::Pubkey) -> &mut Self {
204                        self.staked_token_mint = Some(staked_token_mint);
205                    self
206    }
207            #[inline(always)]
208    pub fn intermediate_token_mint(&mut self, intermediate_token_mint: solana_pubkey::Pubkey) -> &mut Self {
209                        self.intermediate_token_mint = Some(intermediate_token_mint);
210                    self
211    }
212            #[inline(always)]
213    pub fn reward_token_mint(&mut self, reward_token_mint: solana_pubkey::Pubkey) -> &mut Self {
214                        self.reward_token_mint = Some(reward_token_mint);
215                    self
216    }
217            #[inline(always)]
218    pub fn treasury_staked_token_account(&mut self, treasury_staked_token_account: solana_pubkey::Pubkey) -> &mut Self {
219                        self.treasury_staked_token_account = Some(treasury_staked_token_account);
220                    self
221    }
222            #[inline(always)]
223    pub fn treasury_reward_token_account(&mut self, treasury_reward_token_account: solana_pubkey::Pubkey) -> &mut Self {
224                        self.treasury_reward_token_account = Some(treasury_reward_token_account);
225                    self
226    }
227            #[inline(always)]
228    pub fn fusionamm_program(&mut self, fusionamm_program: solana_pubkey::Pubkey) -> &mut Self {
229                        self.fusionamm_program = Some(fusionamm_program);
230                    self
231    }
232            #[inline(always)]
233    pub fn fusion_pool_one(&mut self, fusion_pool_one: solana_pubkey::Pubkey) -> &mut Self {
234                        self.fusion_pool_one = Some(fusion_pool_one);
235                    self
236    }
237            #[inline(always)]
238    pub fn fusion_pool_two(&mut self, fusion_pool_two: solana_pubkey::Pubkey) -> &mut Self {
239                        self.fusion_pool_two = Some(fusion_pool_two);
240                    self
241    }
242            /// `[optional account, default to 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA']`
243#[inline(always)]
244    pub fn token_program(&mut self, token_program: solana_pubkey::Pubkey) -> &mut Self {
245                        self.token_program = Some(token_program);
246                    self
247    }
248            #[inline(always)]
249    pub fn memo_program(&mut self, memo_program: solana_pubkey::Pubkey) -> &mut Self {
250                        self.memo_program = Some(memo_program);
251                    self
252    }
253            /// Add an additional account to the instruction.
254  #[inline(always)]
255  pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self {
256    self.__remaining_accounts.push(account);
257    self
258  }
259  /// Add additional accounts to the instruction.
260  #[inline(always)]
261  pub fn add_remaining_accounts(&mut self, accounts: &[solana_instruction::AccountMeta]) -> &mut Self {
262    self.__remaining_accounts.extend_from_slice(accounts);
263    self
264  }
265  #[allow(clippy::clone_on_copy)]
266  pub fn instruction(&self) -> solana_instruction::Instruction {
267    let accounts = CompoundRewardTwoHop {
268                              authority: self.authority.expect("authority is not set"),
269                                        treasury: self.treasury.expect("treasury is not set"),
270                                        position: self.position.expect("position is not set"),
271                                        staked_token_mint: self.staked_token_mint.expect("staked_token_mint is not set"),
272                                        intermediate_token_mint: self.intermediate_token_mint.expect("intermediate_token_mint is not set"),
273                                        reward_token_mint: self.reward_token_mint.expect("reward_token_mint is not set"),
274                                        treasury_staked_token_account: self.treasury_staked_token_account.expect("treasury_staked_token_account is not set"),
275                                        treasury_reward_token_account: self.treasury_reward_token_account.expect("treasury_reward_token_account is not set"),
276                                        fusionamm_program: self.fusionamm_program.expect("fusionamm_program is not set"),
277                                        fusion_pool_one: self.fusion_pool_one.expect("fusion_pool_one is not set"),
278                                        fusion_pool_two: self.fusion_pool_two.expect("fusion_pool_two is not set"),
279                                        token_program: self.token_program.unwrap_or(solana_pubkey::pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA")),
280                                        memo_program: self.memo_program.expect("memo_program is not set"),
281                      };
282    
283    accounts.instruction_with_remaining_accounts(&self.__remaining_accounts)
284  }
285}
286
287  /// `compound_reward_two_hop` CPI accounts.
288  pub struct CompoundRewardTwoHopCpiAccounts<'a, 'b> {
289          
290                    
291              pub authority: &'b solana_account_info::AccountInfo<'a>,
292                
293                    
294              pub treasury: &'b solana_account_info::AccountInfo<'a>,
295                
296                    
297              pub position: &'b solana_account_info::AccountInfo<'a>,
298                
299                    
300              pub staked_token_mint: &'b solana_account_info::AccountInfo<'a>,
301                
302                    
303              pub intermediate_token_mint: &'b solana_account_info::AccountInfo<'a>,
304                
305                    
306              pub reward_token_mint: &'b solana_account_info::AccountInfo<'a>,
307                
308                    
309              pub treasury_staked_token_account: &'b solana_account_info::AccountInfo<'a>,
310                
311                    
312              pub treasury_reward_token_account: &'b solana_account_info::AccountInfo<'a>,
313                
314                    
315              pub fusionamm_program: &'b solana_account_info::AccountInfo<'a>,
316                
317                    
318              pub fusion_pool_one: &'b solana_account_info::AccountInfo<'a>,
319                
320                    
321              pub fusion_pool_two: &'b solana_account_info::AccountInfo<'a>,
322                
323                    
324              pub token_program: &'b solana_account_info::AccountInfo<'a>,
325                
326                    
327              pub memo_program: &'b solana_account_info::AccountInfo<'a>,
328            }
329
330/// `compound_reward_two_hop` CPI instruction.
331pub struct CompoundRewardTwoHopCpi<'a, 'b> {
332  /// The program to invoke.
333  pub __program: &'b solana_account_info::AccountInfo<'a>,
334      
335              
336          pub authority: &'b solana_account_info::AccountInfo<'a>,
337          
338              
339          pub treasury: &'b solana_account_info::AccountInfo<'a>,
340          
341              
342          pub position: &'b solana_account_info::AccountInfo<'a>,
343          
344              
345          pub staked_token_mint: &'b solana_account_info::AccountInfo<'a>,
346          
347              
348          pub intermediate_token_mint: &'b solana_account_info::AccountInfo<'a>,
349          
350              
351          pub reward_token_mint: &'b solana_account_info::AccountInfo<'a>,
352          
353              
354          pub treasury_staked_token_account: &'b solana_account_info::AccountInfo<'a>,
355          
356              
357          pub treasury_reward_token_account: &'b solana_account_info::AccountInfo<'a>,
358          
359              
360          pub fusionamm_program: &'b solana_account_info::AccountInfo<'a>,
361          
362              
363          pub fusion_pool_one: &'b solana_account_info::AccountInfo<'a>,
364          
365              
366          pub fusion_pool_two: &'b solana_account_info::AccountInfo<'a>,
367          
368              
369          pub token_program: &'b solana_account_info::AccountInfo<'a>,
370          
371              
372          pub memo_program: &'b solana_account_info::AccountInfo<'a>,
373        }
374
375impl<'a, 'b> CompoundRewardTwoHopCpi<'a, 'b> {
376  pub fn new(
377    program: &'b solana_account_info::AccountInfo<'a>,
378          accounts: CompoundRewardTwoHopCpiAccounts<'a, 'b>,
379          ) -> Self {
380    Self {
381      __program: program,
382              authority: accounts.authority,
383              treasury: accounts.treasury,
384              position: accounts.position,
385              staked_token_mint: accounts.staked_token_mint,
386              intermediate_token_mint: accounts.intermediate_token_mint,
387              reward_token_mint: accounts.reward_token_mint,
388              treasury_staked_token_account: accounts.treasury_staked_token_account,
389              treasury_reward_token_account: accounts.treasury_reward_token_account,
390              fusionamm_program: accounts.fusionamm_program,
391              fusion_pool_one: accounts.fusion_pool_one,
392              fusion_pool_two: accounts.fusion_pool_two,
393              token_program: accounts.token_program,
394              memo_program: accounts.memo_program,
395                }
396  }
397  #[inline(always)]
398  pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult {
399    self.invoke_signed_with_remaining_accounts(&[], &[])
400  }
401  #[inline(always)]
402  pub fn invoke_with_remaining_accounts(&self, remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)]) -> solana_program_entrypoint::ProgramResult {
403    self.invoke_signed_with_remaining_accounts(&[], remaining_accounts)
404  }
405  #[inline(always)]
406  pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_entrypoint::ProgramResult {
407    self.invoke_signed_with_remaining_accounts(signers_seeds, &[])
408  }
409  #[allow(clippy::arithmetic_side_effects)]
410  #[allow(clippy::clone_on_copy)]
411  #[allow(clippy::vec_init_then_push)]
412  pub fn invoke_signed_with_remaining_accounts(
413    &self,
414    signers_seeds: &[&[&[u8]]],
415    remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)]
416  ) -> solana_program_entrypoint::ProgramResult {
417    let mut accounts = Vec::with_capacity(13+ remaining_accounts.len());
418                            accounts.push(solana_instruction::AccountMeta::new(
419            *self.authority.key,
420            true
421          ));
422                                          accounts.push(solana_instruction::AccountMeta::new(
423            *self.treasury.key,
424            false
425          ));
426                                          accounts.push(solana_instruction::AccountMeta::new(
427            *self.position.key,
428            false
429          ));
430                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
431            *self.staked_token_mint.key,
432            false
433          ));
434                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
435            *self.intermediate_token_mint.key,
436            false
437          ));
438                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
439            *self.reward_token_mint.key,
440            false
441          ));
442                                          accounts.push(solana_instruction::AccountMeta::new(
443            *self.treasury_staked_token_account.key,
444            false
445          ));
446                                          accounts.push(solana_instruction::AccountMeta::new(
447            *self.treasury_reward_token_account.key,
448            false
449          ));
450                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
451            *self.fusionamm_program.key,
452            false
453          ));
454                                          accounts.push(solana_instruction::AccountMeta::new(
455            *self.fusion_pool_one.key,
456            false
457          ));
458                                          accounts.push(solana_instruction::AccountMeta::new(
459            *self.fusion_pool_two.key,
460            false
461          ));
462                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
463            *self.token_program.key,
464            false
465          ));
466                                          accounts.push(solana_instruction::AccountMeta::new_readonly(
467            *self.memo_program.key,
468            false
469          ));
470                      remaining_accounts.iter().for_each(|remaining_account| {
471      accounts.push(solana_instruction::AccountMeta {
472          pubkey: *remaining_account.0.key,
473          is_signer: remaining_account.1,
474          is_writable: remaining_account.2,
475      })
476    });
477    let data = borsh::to_vec(&CompoundRewardTwoHopInstructionData::new()).unwrap();
478    
479    let instruction = solana_instruction::Instruction {
480      program_id: crate::TUNA_STAKING_ID,
481      accounts,
482      data,
483    };
484    let mut account_infos = Vec::with_capacity(14 + remaining_accounts.len());
485    account_infos.push(self.__program.clone());
486                  account_infos.push(self.authority.clone());
487                        account_infos.push(self.treasury.clone());
488                        account_infos.push(self.position.clone());
489                        account_infos.push(self.staked_token_mint.clone());
490                        account_infos.push(self.intermediate_token_mint.clone());
491                        account_infos.push(self.reward_token_mint.clone());
492                        account_infos.push(self.treasury_staked_token_account.clone());
493                        account_infos.push(self.treasury_reward_token_account.clone());
494                        account_infos.push(self.fusionamm_program.clone());
495                        account_infos.push(self.fusion_pool_one.clone());
496                        account_infos.push(self.fusion_pool_two.clone());
497                        account_infos.push(self.token_program.clone());
498                        account_infos.push(self.memo_program.clone());
499              remaining_accounts.iter().for_each(|remaining_account| account_infos.push(remaining_account.0.clone()));
500
501    if signers_seeds.is_empty() {
502      solana_cpi::invoke(&instruction, &account_infos)
503    } else {
504      solana_cpi::invoke_signed(&instruction, &account_infos, signers_seeds)
505    }
506  }
507}
508
509/// Instruction builder for `CompoundRewardTwoHop` via CPI.
510///
511/// ### Accounts:
512///
513                      ///   0. `[writable, signer]` authority
514                ///   1. `[writable]` treasury
515                ///   2. `[writable]` position
516          ///   3. `[]` staked_token_mint
517          ///   4. `[]` intermediate_token_mint
518          ///   5. `[]` reward_token_mint
519                ///   6. `[writable]` treasury_staked_token_account
520                ///   7. `[writable]` treasury_reward_token_account
521          ///   8. `[]` fusionamm_program
522                ///   9. `[writable]` fusion_pool_one
523                ///   10. `[writable]` fusion_pool_two
524          ///   11. `[]` token_program
525          ///   12. `[]` memo_program
526#[derive(Clone, Debug)]
527pub struct CompoundRewardTwoHopCpiBuilder<'a, 'b> {
528  instruction: Box<CompoundRewardTwoHopCpiBuilderInstruction<'a, 'b>>,
529}
530
531impl<'a, 'b> CompoundRewardTwoHopCpiBuilder<'a, 'b> {
532  pub fn new(program: &'b solana_account_info::AccountInfo<'a>) -> Self {
533    let instruction = Box::new(CompoundRewardTwoHopCpiBuilderInstruction {
534      __program: program,
535              authority: None,
536              treasury: None,
537              position: None,
538              staked_token_mint: None,
539              intermediate_token_mint: None,
540              reward_token_mint: None,
541              treasury_staked_token_account: None,
542              treasury_reward_token_account: None,
543              fusionamm_program: None,
544              fusion_pool_one: None,
545              fusion_pool_two: None,
546              token_program: None,
547              memo_program: None,
548                                __remaining_accounts: Vec::new(),
549    });
550    Self { instruction }
551  }
552      #[inline(always)]
553    pub fn authority(&mut self, authority: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
554                        self.instruction.authority = Some(authority);
555                    self
556    }
557      #[inline(always)]
558    pub fn treasury(&mut self, treasury: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
559                        self.instruction.treasury = Some(treasury);
560                    self
561    }
562      #[inline(always)]
563    pub fn position(&mut self, position: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
564                        self.instruction.position = Some(position);
565                    self
566    }
567      #[inline(always)]
568    pub fn staked_token_mint(&mut self, staked_token_mint: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
569                        self.instruction.staked_token_mint = Some(staked_token_mint);
570                    self
571    }
572      #[inline(always)]
573    pub fn intermediate_token_mint(&mut self, intermediate_token_mint: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
574                        self.instruction.intermediate_token_mint = Some(intermediate_token_mint);
575                    self
576    }
577      #[inline(always)]
578    pub fn reward_token_mint(&mut self, reward_token_mint: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
579                        self.instruction.reward_token_mint = Some(reward_token_mint);
580                    self
581    }
582      #[inline(always)]
583    pub fn treasury_staked_token_account(&mut self, treasury_staked_token_account: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
584                        self.instruction.treasury_staked_token_account = Some(treasury_staked_token_account);
585                    self
586    }
587      #[inline(always)]
588    pub fn treasury_reward_token_account(&mut self, treasury_reward_token_account: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
589                        self.instruction.treasury_reward_token_account = Some(treasury_reward_token_account);
590                    self
591    }
592      #[inline(always)]
593    pub fn fusionamm_program(&mut self, fusionamm_program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
594                        self.instruction.fusionamm_program = Some(fusionamm_program);
595                    self
596    }
597      #[inline(always)]
598    pub fn fusion_pool_one(&mut self, fusion_pool_one: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
599                        self.instruction.fusion_pool_one = Some(fusion_pool_one);
600                    self
601    }
602      #[inline(always)]
603    pub fn fusion_pool_two(&mut self, fusion_pool_two: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
604                        self.instruction.fusion_pool_two = Some(fusion_pool_two);
605                    self
606    }
607      #[inline(always)]
608    pub fn token_program(&mut self, token_program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
609                        self.instruction.token_program = Some(token_program);
610                    self
611    }
612      #[inline(always)]
613    pub fn memo_program(&mut self, memo_program: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
614                        self.instruction.memo_program = Some(memo_program);
615                    self
616    }
617            /// Add an additional account to the instruction.
618  #[inline(always)]
619  pub fn add_remaining_account(&mut self, account: &'b solana_account_info::AccountInfo<'a>, is_writable: bool, is_signer: bool) -> &mut Self {
620    self.instruction.__remaining_accounts.push((account, is_writable, is_signer));
621    self
622  }
623  /// Add additional accounts to the instruction.
624  ///
625  /// Each account is represented by a tuple of the `AccountInfo`, a `bool` indicating whether the account is writable or not,
626  /// and a `bool` indicating whether the account is a signer or not.
627  #[inline(always)]
628  pub fn add_remaining_accounts(&mut self, accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)]) -> &mut Self {
629    self.instruction.__remaining_accounts.extend_from_slice(accounts);
630    self
631  }
632  #[inline(always)]
633  pub fn invoke(&self) -> solana_program_entrypoint::ProgramResult {
634    self.invoke_signed(&[])
635  }
636  #[allow(clippy::clone_on_copy)]
637  #[allow(clippy::vec_init_then_push)]
638  pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_entrypoint::ProgramResult {
639        let instruction = CompoundRewardTwoHopCpi {
640        __program: self.instruction.__program,
641                  
642          authority: self.instruction.authority.expect("authority is not set"),
643                  
644          treasury: self.instruction.treasury.expect("treasury is not set"),
645                  
646          position: self.instruction.position.expect("position is not set"),
647                  
648          staked_token_mint: self.instruction.staked_token_mint.expect("staked_token_mint is not set"),
649                  
650          intermediate_token_mint: self.instruction.intermediate_token_mint.expect("intermediate_token_mint is not set"),
651                  
652          reward_token_mint: self.instruction.reward_token_mint.expect("reward_token_mint is not set"),
653                  
654          treasury_staked_token_account: self.instruction.treasury_staked_token_account.expect("treasury_staked_token_account is not set"),
655                  
656          treasury_reward_token_account: self.instruction.treasury_reward_token_account.expect("treasury_reward_token_account is not set"),
657                  
658          fusionamm_program: self.instruction.fusionamm_program.expect("fusionamm_program is not set"),
659                  
660          fusion_pool_one: self.instruction.fusion_pool_one.expect("fusion_pool_one is not set"),
661                  
662          fusion_pool_two: self.instruction.fusion_pool_two.expect("fusion_pool_two is not set"),
663                  
664          token_program: self.instruction.token_program.expect("token_program is not set"),
665                  
666          memo_program: self.instruction.memo_program.expect("memo_program is not set"),
667                    };
668    instruction.invoke_signed_with_remaining_accounts(signers_seeds, &self.instruction.__remaining_accounts)
669  }
670}
671
672#[derive(Clone, Debug)]
673struct CompoundRewardTwoHopCpiBuilderInstruction<'a, 'b> {
674  __program: &'b solana_account_info::AccountInfo<'a>,
675            authority: Option<&'b solana_account_info::AccountInfo<'a>>,
676                treasury: Option<&'b solana_account_info::AccountInfo<'a>>,
677                position: Option<&'b solana_account_info::AccountInfo<'a>>,
678                staked_token_mint: Option<&'b solana_account_info::AccountInfo<'a>>,
679                intermediate_token_mint: Option<&'b solana_account_info::AccountInfo<'a>>,
680                reward_token_mint: Option<&'b solana_account_info::AccountInfo<'a>>,
681                treasury_staked_token_account: Option<&'b solana_account_info::AccountInfo<'a>>,
682                treasury_reward_token_account: Option<&'b solana_account_info::AccountInfo<'a>>,
683                fusionamm_program: Option<&'b solana_account_info::AccountInfo<'a>>,
684                fusion_pool_one: Option<&'b solana_account_info::AccountInfo<'a>>,
685                fusion_pool_two: Option<&'b solana_account_info::AccountInfo<'a>>,
686                token_program: Option<&'b solana_account_info::AccountInfo<'a>>,
687                memo_program: Option<&'b solana_account_info::AccountInfo<'a>>,
688                /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`.
689  __remaining_accounts: Vec<(&'b solana_account_info::AccountInfo<'a>, bool, bool)>,
690}
691