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