satrush_client/generated/instructions/
update_deploy_fees.rs1use borsh::BorshSerialize;
9use borsh::BorshDeserialize;
10
11pub const UPDATE_DEPLOY_FEES_DISCRIMINATOR: [u8; 8] = [0, 170, 26, 215, 156, 171, 22, 68];
12
13#[derive(Debug)]
15pub struct UpdateDeployFees {
16
17
18 pub authority: solana_address::Address,
19
20
21 pub satrush_config: solana_address::Address,
22 }
23
24impl UpdateDeployFees {
25 pub fn instruction(&self, args: UpdateDeployFeesInstructionArgs) -> solana_instruction::Instruction {
26 self.instruction_with_remaining_accounts(args, &[])
27 }
28 #[allow(clippy::arithmetic_side_effects)]
29 #[allow(clippy::vec_init_then_push)]
30 pub fn instruction_with_remaining_accounts(&self, args: UpdateDeployFeesInstructionArgs, remaining_accounts: &[solana_instruction::AccountMeta]) -> solana_instruction::Instruction {
31 let mut accounts = Vec::with_capacity(2+ remaining_accounts.len());
32 accounts.push(solana_instruction::AccountMeta::new_readonly(
33 self.authority,
34 true
35 ));
36 accounts.push(solana_instruction::AccountMeta::new(
37 self.satrush_config,
38 false
39 ));
40 accounts.extend_from_slice(remaining_accounts);
41 let mut data = UpdateDeployFeesInstructionData::new().try_to_vec().unwrap();
42 let mut args = args.try_to_vec().unwrap();
43 data.append(&mut args);
44
45 solana_instruction::Instruction {
46 program_id: crate::SATRUSH_ID,
47 accounts,
48 data,
49 }
50 }
51}
52
53#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
54 pub struct UpdateDeployFeesInstructionData {
55 discriminator: [u8; 8],
56 }
57
58impl UpdateDeployFeesInstructionData {
59 pub fn new() -> Self {
60 Self {
61 discriminator: [0, 170, 26, 215, 156, 171, 22, 68],
62 }
63 }
64
65 pub(crate) fn try_to_vec(&self) -> Result<Vec<u8>, std::io::Error> {
66 borsh::to_vec(self)
67 }
68 }
69
70impl Default for UpdateDeployFeesInstructionData {
71 fn default() -> Self {
72 Self::new()
73 }
74}
75
76#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
77 pub struct UpdateDeployFeesInstructionArgs {
78 pub new_strike_fee_bps: u32,
79 pub new_epoch_fee_bps: u32,
80 pub new_one_btc_fee_bps: u32,
81 pub new_protocol_fee_bps: u32,
82 }
83
84impl UpdateDeployFeesInstructionArgs {
85 pub(crate) fn try_to_vec(&self) -> Result<Vec<u8>, std::io::Error> {
86 borsh::to_vec(self)
87 }
88}
89
90
91#[derive(Clone, Debug, Default)]
98pub struct UpdateDeployFeesBuilder {
99 authority: Option<solana_address::Address>,
100 satrush_config: Option<solana_address::Address>,
101 new_strike_fee_bps: Option<u32>,
102 new_epoch_fee_bps: Option<u32>,
103 new_one_btc_fee_bps: Option<u32>,
104 new_protocol_fee_bps: Option<u32>,
105 __remaining_accounts: Vec<solana_instruction::AccountMeta>,
106}
107
108impl UpdateDeployFeesBuilder {
109 pub fn new() -> Self {
110 Self::default()
111 }
112 #[inline(always)]
113 pub fn authority(&mut self, authority: solana_address::Address) -> &mut Self {
114 self.authority = Some(authority);
115 self
116 }
117 #[inline(always)]
118 pub fn satrush_config(&mut self, satrush_config: solana_address::Address) -> &mut Self {
119 self.satrush_config = Some(satrush_config);
120 self
121 }
122 #[inline(always)]
123 pub fn new_strike_fee_bps(&mut self, new_strike_fee_bps: u32) -> &mut Self {
124 self.new_strike_fee_bps = Some(new_strike_fee_bps);
125 self
126 }
127 #[inline(always)]
128 pub fn new_epoch_fee_bps(&mut self, new_epoch_fee_bps: u32) -> &mut Self {
129 self.new_epoch_fee_bps = Some(new_epoch_fee_bps);
130 self
131 }
132 #[inline(always)]
133 pub fn new_one_btc_fee_bps(&mut self, new_one_btc_fee_bps: u32) -> &mut Self {
134 self.new_one_btc_fee_bps = Some(new_one_btc_fee_bps);
135 self
136 }
137 #[inline(always)]
138 pub fn new_protocol_fee_bps(&mut self, new_protocol_fee_bps: u32) -> &mut Self {
139 self.new_protocol_fee_bps = Some(new_protocol_fee_bps);
140 self
141 }
142 #[inline(always)]
144 pub fn add_remaining_account(&mut self, account: solana_instruction::AccountMeta) -> &mut Self {
145 self.__remaining_accounts.push(account);
146 self
147 }
148 #[inline(always)]
150 pub fn add_remaining_accounts(&mut self, accounts: &[solana_instruction::AccountMeta]) -> &mut Self {
151 self.__remaining_accounts.extend_from_slice(accounts);
152 self
153 }
154 #[allow(clippy::clone_on_copy)]
155 pub fn instruction(&self) -> solana_instruction::Instruction {
156 let accounts = UpdateDeployFees {
157 authority: self.authority.expect("authority is not set"),
158 satrush_config: self.satrush_config.expect("satrush_config is not set"),
159 };
160 let args = UpdateDeployFeesInstructionArgs {
161 new_strike_fee_bps: self.new_strike_fee_bps.clone().expect("new_strike_fee_bps is not set"),
162 new_epoch_fee_bps: self.new_epoch_fee_bps.clone().expect("new_epoch_fee_bps is not set"),
163 new_one_btc_fee_bps: self.new_one_btc_fee_bps.clone().expect("new_one_btc_fee_bps is not set"),
164 new_protocol_fee_bps: self.new_protocol_fee_bps.clone().expect("new_protocol_fee_bps is not set"),
165 };
166
167 accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts)
168 }
169}
170
171 pub struct UpdateDeployFeesCpiAccounts<'a, 'b> {
173
174
175 pub authority: &'b solana_account_info::AccountInfo<'a>,
176
177
178 pub satrush_config: &'b solana_account_info::AccountInfo<'a>,
179 }
180
181pub struct UpdateDeployFeesCpi<'a, 'b> {
183 pub __program: &'b solana_account_info::AccountInfo<'a>,
185
186
187 pub authority: &'b solana_account_info::AccountInfo<'a>,
188
189
190 pub satrush_config: &'b solana_account_info::AccountInfo<'a>,
191 pub __args: UpdateDeployFeesInstructionArgs,
193 }
194
195impl<'a, 'b> UpdateDeployFeesCpi<'a, 'b> {
196 pub fn new(
197 program: &'b solana_account_info::AccountInfo<'a>,
198 accounts: UpdateDeployFeesCpiAccounts<'a, 'b>,
199 args: UpdateDeployFeesInstructionArgs,
200 ) -> Self {
201 Self {
202 __program: program,
203 authority: accounts.authority,
204 satrush_config: accounts.satrush_config,
205 __args: args,
206 }
207 }
208 #[inline(always)]
209 pub fn invoke(&self) -> solana_program_error::ProgramResult {
210 self.invoke_signed_with_remaining_accounts(&[], &[])
211 }
212 #[inline(always)]
213 pub fn invoke_with_remaining_accounts(&self, remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)]) -> solana_program_error::ProgramResult {
214 self.invoke_signed_with_remaining_accounts(&[], remaining_accounts)
215 }
216 #[inline(always)]
217 pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult {
218 self.invoke_signed_with_remaining_accounts(signers_seeds, &[])
219 }
220 #[allow(clippy::arithmetic_side_effects)]
221 #[allow(clippy::clone_on_copy)]
222 #[allow(clippy::vec_init_then_push)]
223 pub fn invoke_signed_with_remaining_accounts(
224 &self,
225 signers_seeds: &[&[&[u8]]],
226 remaining_accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)]
227 ) -> solana_program_error::ProgramResult {
228 let mut accounts = Vec::with_capacity(2+ remaining_accounts.len());
229 accounts.push(solana_instruction::AccountMeta::new_readonly(
230 *self.authority.key,
231 true
232 ));
233 accounts.push(solana_instruction::AccountMeta::new(
234 *self.satrush_config.key,
235 false
236 ));
237 remaining_accounts.iter().for_each(|remaining_account| {
238 accounts.push(solana_instruction::AccountMeta {
239 pubkey: *remaining_account.0.key,
240 is_signer: remaining_account.1,
241 is_writable: remaining_account.2,
242 })
243 });
244 let mut data = UpdateDeployFeesInstructionData::new().try_to_vec().unwrap();
245 let mut args = self.__args.try_to_vec().unwrap();
246 data.append(&mut args);
247
248 let instruction = solana_instruction::Instruction {
249 program_id: crate::SATRUSH_ID,
250 accounts,
251 data,
252 };
253 let mut account_infos = Vec::with_capacity(3 + remaining_accounts.len());
254 account_infos.push(self.__program.clone());
255 account_infos.push(self.authority.clone());
256 account_infos.push(self.satrush_config.clone());
257 remaining_accounts.iter().for_each(|remaining_account| account_infos.push(remaining_account.0.clone()));
258
259 if signers_seeds.is_empty() {
260 solana_cpi::invoke(&instruction, &account_infos)
261 } else {
262 solana_cpi::invoke_signed(&instruction, &account_infos, signers_seeds)
263 }
264 }
265}
266
267#[derive(Clone, Debug)]
274pub struct UpdateDeployFeesCpiBuilder<'a, 'b> {
275 instruction: Box<UpdateDeployFeesCpiBuilderInstruction<'a, 'b>>,
276}
277
278impl<'a, 'b> UpdateDeployFeesCpiBuilder<'a, 'b> {
279 pub fn new(program: &'b solana_account_info::AccountInfo<'a>) -> Self {
280 let instruction = Box::new(UpdateDeployFeesCpiBuilderInstruction {
281 __program: program,
282 authority: None,
283 satrush_config: None,
284 new_strike_fee_bps: None,
285 new_epoch_fee_bps: None,
286 new_one_btc_fee_bps: None,
287 new_protocol_fee_bps: None,
288 __remaining_accounts: Vec::new(),
289 });
290 Self { instruction }
291 }
292 #[inline(always)]
293 pub fn authority(&mut self, authority: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
294 self.instruction.authority = Some(authority);
295 self
296 }
297 #[inline(always)]
298 pub fn satrush_config(&mut self, satrush_config: &'b solana_account_info::AccountInfo<'a>) -> &mut Self {
299 self.instruction.satrush_config = Some(satrush_config);
300 self
301 }
302 #[inline(always)]
303 pub fn new_strike_fee_bps(&mut self, new_strike_fee_bps: u32) -> &mut Self {
304 self.instruction.new_strike_fee_bps = Some(new_strike_fee_bps);
305 self
306 }
307 #[inline(always)]
308 pub fn new_epoch_fee_bps(&mut self, new_epoch_fee_bps: u32) -> &mut Self {
309 self.instruction.new_epoch_fee_bps = Some(new_epoch_fee_bps);
310 self
311 }
312 #[inline(always)]
313 pub fn new_one_btc_fee_bps(&mut self, new_one_btc_fee_bps: u32) -> &mut Self {
314 self.instruction.new_one_btc_fee_bps = Some(new_one_btc_fee_bps);
315 self
316 }
317 #[inline(always)]
318 pub fn new_protocol_fee_bps(&mut self, new_protocol_fee_bps: u32) -> &mut Self {
319 self.instruction.new_protocol_fee_bps = Some(new_protocol_fee_bps);
320 self
321 }
322 #[inline(always)]
324 pub fn add_remaining_account(&mut self, account: &'b solana_account_info::AccountInfo<'a>, is_writable: bool, is_signer: bool) -> &mut Self {
325 self.instruction.__remaining_accounts.push((account, is_writable, is_signer));
326 self
327 }
328 #[inline(always)]
333 pub fn add_remaining_accounts(&mut self, accounts: &[(&'b solana_account_info::AccountInfo<'a>, bool, bool)]) -> &mut Self {
334 self.instruction.__remaining_accounts.extend_from_slice(accounts);
335 self
336 }
337 #[inline(always)]
338 pub fn invoke(&self) -> solana_program_error::ProgramResult {
339 self.invoke_signed(&[])
340 }
341 #[allow(clippy::clone_on_copy)]
342 #[allow(clippy::vec_init_then_push)]
343 pub fn invoke_signed(&self, signers_seeds: &[&[&[u8]]]) -> solana_program_error::ProgramResult {
344 let args = UpdateDeployFeesInstructionArgs {
345 new_strike_fee_bps: self.instruction.new_strike_fee_bps.clone().expect("new_strike_fee_bps is not set"),
346 new_epoch_fee_bps: self.instruction.new_epoch_fee_bps.clone().expect("new_epoch_fee_bps is not set"),
347 new_one_btc_fee_bps: self.instruction.new_one_btc_fee_bps.clone().expect("new_one_btc_fee_bps is not set"),
348 new_protocol_fee_bps: self.instruction.new_protocol_fee_bps.clone().expect("new_protocol_fee_bps is not set"),
349 };
350 let instruction = UpdateDeployFeesCpi {
351 __program: self.instruction.__program,
352
353 authority: self.instruction.authority.expect("authority is not set"),
354
355 satrush_config: self.instruction.satrush_config.expect("satrush_config is not set"),
356 __args: args,
357 };
358 instruction.invoke_signed_with_remaining_accounts(signers_seeds, &self.instruction.__remaining_accounts)
359 }
360}
361
362#[derive(Clone, Debug)]
363struct UpdateDeployFeesCpiBuilderInstruction<'a, 'b> {
364 __program: &'b solana_account_info::AccountInfo<'a>,
365 authority: Option<&'b solana_account_info::AccountInfo<'a>>,
366 satrush_config: Option<&'b solana_account_info::AccountInfo<'a>>,
367 new_strike_fee_bps: Option<u32>,
368 new_epoch_fee_bps: Option<u32>,
369 new_one_btc_fee_bps: Option<u32>,
370 new_protocol_fee_bps: Option<u32>,
371 __remaining_accounts: Vec<(&'b solana_account_info::AccountInfo<'a>, bool, bool)>,
373}
374