1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
use anchor_lang::prelude::*;

use anchor_spl::{
    associated_token::AssociatedToken,
    token::{Mint, Token, TokenAccount},
};

declare_id!("strmRqUCoQUgGUan5YhzUZa6KqdzwX5L6FpUxfmKg5m");

/// Streamflow sdk module defining anchor account structs expected from the streamflow protocol
/// as well as anchor cpi module used for invoking streamflow protocol
///
/// ## Usage
///
/// Declaring a dependency in program's Cargo.toml
///
/// ```ignore
/// streamflow_sdk = {version = "0.6.0", features = ["cpi"]}
/// ```
///
/// Example anchor program invoking streamflow create instruction
///
///
/// ```ignore
/// use anchor_lang::prelude::*;
/// use anchor_spl::{
///     associated_token::AssociatedToken,
///     token::{Mint, Token, TokenAccount},
/// };
///
/// use streamflow_sdk::cpi::accounts::{
///     Create as CpiCreate,
///     Update as CpiUpdate,
///     Withdraw as CpiWithdraw,
///     Topup as CpiTopup,
///     Transfer as CpiTransfer,
///     Cancel as CpiCancel,
/// };
///
/// declare_id!("FGjLaVo5zLGdzCxMo9gu9tXr1kzTToKd8C8K7YS5hNM1");
///
/// #[program]
/// pub mod example_program {
///     use super::*;
///
///     //importing parameter struct for stream/vesting contract creation
///     use streamflow_sdk::CreateParams;
///
///     //anchor rpc handlers
///     pub fn create(
///         ctx: Context<Create>,
///         start_time: u64,
///         net_amount_deposited: u64,
///         period: u64,
///         amount_per_period: u64,
///         cliff: u64,
///         cliff_amount: u64,
///         cancelable_by_sender: bool,
///         cancelable_by_recipient: bool,
///         automatic_withdrawal: bool,
///         transferable_by_sender: bool,
///         transferable_by_recipient: bool,
///         can_topup: bool,
///         stream_name: [u8; 64],
///         withdraw_frequency: u64,
///     ) -> ProgramResult {
///         let ix = CreateParams {
///             start_time,
///             net_amount_deposited,
///             period,
///             amount_per_period,
///             cliff,
///             cliff_amount,
///             cancelable_by_sender,
///             cancelable_by_recipient,
///             automatic_withdrawal,
///             transferable_by_sender,
///             transferable_by_recipient,
///             can_topup,
///             stream_name,
///             withdraw_frequency,
///         };
///
///         // initializing accounts struct for cross-program invoke
///         let accs = CpiCreate {
///             sender: ctx.accounts.sender.to_account_info(),
///             sender_tokens: ctx.accounts.sender_tokens.to_account_info(),
///             recipient: ctx.accounts.recipient.to_account_info(),
///             recipient_tokens: ctx.accounts.recipient_tokens.to_account_info(),
///             metadata: ctx.accounts.metadata.to_account_info(),
///             escrow_tokens: ctx.accounts.escrow_tokens.to_account_info(),
///             streamflow_treasury: ctx.accounts.streamflow_treasury.to_account_info(),
///             streamflow_treasury_tokens:
///             ctx.accounts.streamflow_treasury_tokens.to_account_info(),
///             withdrawor: ctx.accounts.withdrawor.to_account_info(),
///             partner: ctx.accounts.partner.to_account_info(),
///             partner_tokens: ctx.accounts.partner_tokens.to_account_info(),
///             mint: ctx.accounts.mint.to_account_info(),
///             fee_oracle: ctx.accounts.fee_oracle.to_account_info(),
///             rent: ctx.accounts.rent.to_account_info(),
///             timelock_program: ctx.accounts.timelock_program.to_account_info(),
///             token_program: ctx.accounts.token_program.to_account_info(),
///             associated_token_program: ctx.accounts.associated_token_program.to_account_info(),
///             system_program: ctx.accounts.system_program.to_account_info(),
///         };
///
///         // initializing anchor CpiContext, can be used in native solana programs as well
///         // additional reference:
///         // https:///project-serum.github.io/anchor/tutorials/tutorial-3.html
///         let cpi_ctx = CpiContext::new(ctx.accounts.timelock_program.to_account_info(), accs);
///
///         // calling cpi method which calls solana_program invoke with
///         // serialized instruction data fit for streamflow program
///         streamflow_sdk::cpi::create(
///             cpi_ctx,
///             ix.start_time,
///             ix.net_amount_deposited,
///             ix.period,
///             ix.amount_per_period,
///             ix.cliff,
///             ix.cliff_amount,
///             ix.cancelable_by_sender,
///             ix.cancelable_by_recipient,
///             ix.automatic_withdrawal,
///             ix.transferable_by_sender,
///             ix.transferable_by_recipient,
///             ix.can_topup,
///             ix.stream_name,
///             ix.withdraw_frequency,
///         )
///     }
/// ```


#[program]
pub mod streamflow_sdk {
    use super::*;

    /// Anchor rpc handler used for CPI code generation
    #[allow(unused_variables)]
    pub fn create(
        ctx: Context<Create>,
        start_time: u64,
        net_amount_deposited: u64,
        period: u64,
        amount_per_period: u64,
        cliff: u64,
        cliff_amount: u64,
        cancelable_by_sender: bool,
        cancelable_by_recipient: bool,
        automatic_withdrawal: bool,
        transferable_by_sender: bool,
        transferable_by_recipient: bool,
        can_topup: bool,
        stream_name: [u8; 64],
        withdraw_frequency: u64,
    ) -> Result<()> {
        Ok(())
    }

    /// Anchor rpc handler used for CPI code generation
    #[allow(unused_variables)]
    pub fn create_unchecked(
        ctx: Context<CreateUnchecked>,
        start_time: u64,
        net_amount_deposited: u64,
        period: u64,
        amount_per_period: u64,
        cliff: u64,
        cliff_amount: u64,
        cancelable_by_sender: bool,
        cancelable_by_recipient: bool,
        automatic_withdrawal: bool,
        transferable_by_sender: bool,
        transferable_by_recipient: bool,
        can_topup: bool,
        stream_name: [u8; 64],
        withdraw_frequency: u64,
        recipient: Pubkey,
        partner: Pubkey
    ) -> Result<()> { Ok(()) }

    /// Anchor rpc handler used for CPI code generation
    #[allow(unused_variables)]
    pub fn update(
        ctx: Context<Update>,
        enable_automatic_withdrawal: Option<bool>,
        withdraw_frequency: Option<u64>,
        amount_per_period: Option<u64>
    ) -> Result<()> {
        Ok(())
    }

    /// Anchor rpc handler used for CPI code generation
    #[allow(unused_variables)]
    pub fn withdraw(ctx: Context<Withdraw>, amount: u64) -> Result<()> {
        Ok(())
    }

    /// Anchor rpc handler used for CPI code generation
    #[allow(unused_variables)]
    pub fn cancel(ctx: Context<Cancel>) -> Result<()> {
        Ok(())
    }

    /// Anchor rpc handler used for CPI code generation
    #[allow(unused_variables)]
    pub fn pause(ctx: Context<Pause>) -> Result<()> {
        Ok(())
    }

    /// Anchor rpc handler used for CPI code generation
    #[allow(unused_variables)]
    pub fn unpause(ctx: Context<UnPause>) -> Result<()> {
        Ok(())
    }

    /// Anchor rpc handler used for CPI code generation
    #[allow(unused_variables)]
    pub fn transfer_recipient(ctx: Context<Transfer>) -> Result<()> {
        Ok(())
    }

    /// Anchor rpc handler used for CPI code generation
    #[allow(unused_variables)]
    pub fn topup(ctx: Context<Topup>, amount: u64) -> Result<()> {
        Ok(())
    }
}

/// Accounts expected in create instruction
#[derive(Accounts)]
pub struct Create<'info> {
    /// Wallet of the contract creator.
    #[account(mut)]
    pub sender: Signer<'info>,
    /// Associated token account address of `sender`.
    #[account(mut)]
    pub sender_tokens: AccountInfo<'info>,
    /// Wallet address of the recipient.
    #[account(mut)]
    pub recipient: AccountInfo<'info>,
    /// The account holding the contract parameters.
    /// Expects empty (non-initialized) account.
    #[account(mut, signer)]
    pub metadata: AccountInfo<'info>,
    /// The escrow account holding the funds.
    /// Expects empty (non-initialized) account.
    #[account(mut)]
    pub escrow_tokens: AccountInfo<'info>,
    /// Associated token account address of `recipient`.
    #[account(mut)]
    pub recipient_tokens: AccountInfo<'info>,
    /// Streamflow treasury account.
    #[account(mut)]
    pub streamflow_treasury: AccountInfo<'info>,
    /// Associated token account address of `streamflow_treasury`.
    #[account(mut)]
    pub streamflow_treasury_tokens: AccountInfo<'info>,
    /// Delegate account for automatically withdrawing contracts.
    #[account(mut)]
    pub withdrawor: AccountInfo<'info>,
    /// Partner treasury account. If no partner fees are expected on behalf of the program
    /// integrating with streamflow, `streamflow_treasury` can be passed in here.
    #[account(mut)]
    pub partner: AccountInfo<'info>,
    /// Associated token account address of `partner`. If no partner fees are expected on behalf of the
    /// program integrating with streamflow, `streamflow_treasury_tokens` can be passed in here.
    #[account(mut)]
    pub partner_tokens: AccountInfo<'info>,
    /// The SPL token mint account.
    pub mint: Account<'info, Mint>,
    /// Internal program that handles fees for specified partners. If no partner fees are expected
    /// on behalf of the program integrating with streamflow, `streamflow_treasury` can be passed
    /// in here.
    pub fee_oracle: AccountInfo<'info>,
    /// The Rent Sysvar account.
    pub rent: Sysvar<'info, Rent>,
    /// Streamflow protocol (alias timelock) program account.
    pub timelock_program: AccountInfo<'info>,
    /// The SPL program needed in case an associated account
    /// for the new recipient is being created.
    pub token_program: Program<'info, Token>,
    /// The Associated Token program needed in case associated
    /// account for the new recipient is being created.
    pub associated_token_program: Program<'info, AssociatedToken>,
    /// The Solana system program needed for account creation.
    pub system_program: Program<'info, System>,
}

/// Accounts expected in create_unchecked instruction
#[derive(Accounts)]
pub struct CreateUnchecked<'info> {
    /// Wallet of the contract creator.
    #[account(mut)]
    pub sender: Signer<'info>,
    /// Associated token account address of `sender`.
    #[account(mut)]
    pub sender_tokens: AccountInfo<'info>,
    /// The account holding the contract parameters.
    /// Expects account initialized with 1104 bytes.
    #[account(mut)]
    pub metadata: AccountInfo<'info>,
    /// The escrow account holding the funds.
    /// Expects empty (non-initialized) account.
    #[account(mut)]
    pub escrow_tokens: AccountInfo<'info>,
    /// Delegate account for automatically withdrawing contracts.
    #[account(mut)]
    pub withdrawor: AccountInfo<'info>,
    /// The SPL token mint account.
    pub mint: Account<'info, Mint>,
    /// Internal program that handles fees for specified partners. If no partner fees are expected
    /// on behalf of the program integrating with streamflow, `streamflow_treasury` can be passed
    /// in here.
    pub fee_oracle: AccountInfo<'info>,
    /// The Rent Sysvar account.
    pub rent: Sysvar<'info, Rent>,
    /// Streamflow protocol (alias timelock) program account.
    pub timelock_program: AccountInfo<'info>,
    /// The SPL program account.
    pub token_program: Program<'info, Token>,
    /// The Solana system program needed for account creation.
    pub system_program: Program<'info, System>,
}

/// Accounts expected in update instruction
#[derive(Accounts)]
pub struct Update<'info> {
    /// Wallet that initiates contract update.
    #[account(mut)]
    pub sender: Signer<'info>,
    /// The account holding the contract parameters.
    /// Expects initialized account.
    #[account(mut)]
    pub metadata: AccountInfo<'info>,
    /// Delegate account for automatically withdrawing contracts.
    #[account(mut)]
    pub withdrawor: AccountInfo<'info>,
    pub system_program: Program<'info, System>,
}

/// Accounts expected in pause instruction
#[derive(Accounts)]
pub struct Pause<'info> {
    #[account()]
    pub sender: Signer<'info>,
    #[account(mut)]
    pub metadata: AccountInfo<'info>,
}

/// Accounts expected in unpause instruction
#[derive(Accounts)]
pub struct UnPause<'info> {
    #[account()]
    pub sender: Signer<'info>,
    #[account(mut)]
    pub metadata: AccountInfo<'info>,
}

/// Accounts expected in withdraw instruction
#[derive(Accounts)]
pub struct Withdraw<'info> {
    /// Wallet of the contract withdrawor.
    #[account()]
    pub authority: Signer<'info>,
    #[account(mut)]
    /// Wallet address of the recipient.
    pub recipient: AccountInfo<'info>,
    /// Associated token account address of `recipient`.
    #[account(mut)]
    pub recipient_tokens: Account<'info, TokenAccount>,
    /// The account holding the contract parameters.
    /// Expects initialized account.
    #[account(mut)]
    pub metadata: AccountInfo<'info>,
    /// The escrow account holding the funds.
    /// Expects initialized account.
    #[account(mut)]
    pub escrow_tokens: Account<'info, TokenAccount>,
    /// Streamflow treasury account.
    #[account(mut)]
    pub streamflow_treasury: AccountInfo<'info>,
    /// Associated token account address of `streamflow_treasury`.
    #[account(mut)]
    pub streamflow_treasury_tokens: AccountInfo<'info>,
    /// Partner treasury account. If no partner fees are expected on behalf of the program
    /// integrating with streamflow, `streamflow_treasury` can be passed in here.
    /// Must match partner account in contract metadata.
    #[account(mut)]
    pub partner: AccountInfo<'info>,
    /// Associated token account address of `partner`. If no partner fees are expected on behalf of the
    /// program integrating with streamflow, `streamflow_treasury_tokens` can be passed in here.
    /// Must match partner token account in contract metadata.
    #[account(mut)]
    pub partner_tokens: AccountInfo<'info>,
    /// The SPL token mint account.
    pub mint: Account<'info, Mint>,
    /// The SPL program needed in case an associated account
    /// for the new recipient is being created.
    pub token_program: Program<'info, Token>,
}

/// Accounts expected in cancel instruction
#[derive(Accounts)]
pub struct Cancel<'info> {
    /// Wallet that initiates contract cancel.
    #[account()]
    pub authority: Signer<'info>,
    /// Wallet of the contract creator.
    #[account(mut)]
    pub sender: AccountInfo<'info>,
    /// Associated token account address of `sender`.
    #[account(mut)]
    pub sender_tokens: Account<'info, TokenAccount>,
    /// Wallet address of the recipient.
    #[account(mut)]
    pub recipient: AccountInfo<'info>,
    /// Associated token account address of `recipient`.
    #[account(mut)]
    pub recipient_tokens: Account<'info, TokenAccount>,
    /// The account holding the contract parameters.
    /// Expects initialized account.
    #[account(mut)]
    pub metadata: AccountInfo<'info>,
    /// The escrow account holding the funds.
    /// Expects initialized account.
    #[account(mut)]
    pub escrow_tokens: Account<'info, TokenAccount>,
    /// Streamflow treasury account.
    #[account(mut)]
    pub streamflow_treasury: AccountInfo<'info>,
    /// Associated token account address of `streamflow_treasury`.
    #[account(mut)]
    pub streamflow_treasury_tokens: AccountInfo<'info>,
    /// Partner treasury account. If no partner fees are expected on behalf of the program
    /// integrating with streamflow, `streamflow_treasury` can be passed in here. Must match partner
    /// account in contract metadata.
    #[account(mut)]
    pub partner: AccountInfo<'info>,
    /// Associated token account address of `partner`. If no partner fees are expected on behalf of the
    /// program integrating with streamflow, `streamflow_treasury_tokens` can be passed in here.
    /// Must match partner token account in contract metadata.
    #[account(mut)]
    pub partner_tokens: AccountInfo<'info>,
    /// The SPL token mint account.
    pub mint: Account<'info, Mint>,
    /// The SPL program needed in case an associated account
    /// for the new recipient is being created.
    pub token_program: Program<'info, Token>,
}

/// Accounts expected in transfer instruction
#[derive(Accounts)]
pub struct Transfer<'info> {
    /// Wallet that initiates contract transfer.
    #[account(mut)]
    pub authority: Signer<'info>,
    /// Wallet address of the new contract recipient
    #[account(mut)]
    pub new_recipient: AccountInfo<'info>,
    /// Wallet address of the new contract recipient's token account
    #[account(mut)]
    pub new_recipient_tokens: AccountInfo<'info>,
    /// The account holding the contract parameters.
    /// Expects initialized account.
    #[account(mut)]
    pub metadata: AccountInfo<'info>,
    /// The SPL token mint account.
    pub mint: Account<'info, Mint>,
    /// The Rent Sysvar account.
    pub rent: Sysvar<'info, Rent>,
    /// The SPL program needed in case an associated account
    /// for the new recipient is being created.
    pub token_program: Program<'info, Token>,
    /// The Associated Token program needed in case associated
    /// account for the new recipient is being created.
    pub associated_token_program: Program<'info, AssociatedToken>,
    /// The Solana system program needed for account creation.
    pub system_program: Program<'info, System>,
}

/// Accounts expected in topup instruction
#[derive(Accounts)]
pub struct Topup<'info> {
    /// Wallet of the contract creator.
    #[account(mut)]
    pub sender: Signer<'info>,
    /// Associated token account address of `sender`.
    #[account(mut)]
    pub sender_tokens: AccountInfo<'info>,
    /// The account holding the contract parameters.
    /// Expects initialized account.
    #[account(mut)]
    pub metadata: AccountInfo<'info>,
    /// The escrow account holding the funds.
    /// Expects initialized account.
    #[account(mut)]
    pub escrow_tokens: Account<'info, TokenAccount>,
    /// Streamflow treasury account.
    #[account(mut)]
    pub streamflow_treasury: AccountInfo<'info>,
    /// Associated token account address of `streamflow_treasury`.
    #[account(mut)]
    pub streamflow_treasury_tokens: AccountInfo<'info>,
    /// Delegate account for automatically withdrawing contracts.
    #[account(mut)]
    pub withdrawor: AccountInfo<'info>,
    /// Partner treasury account. If no partner fees are expected on behalf of the program
    /// integrating with streamflow, `streamflow_treasury` can be passed in here. Must match partner
    /// account in contract metadata.
    #[account(mut)]
    pub partner: AccountInfo<'info>,
    /// Associated token account address of `partner`. If no partner fees are expected on behalf of the
    /// program integrating with streamflow, `streamflow_treasury_tokens` can be passed in here.
    /// Must match partner token account in contract metadata.
    #[account(mut)]
    pub partner_tokens: AccountInfo<'info>,
    /// The SPL token mint account.
    pub mint: Account<'info, Mint>,
    /// The SPL program needed in case an associated account
    /// for the new recipient is being created.
    pub token_program: Program<'info, Token>,
    /// The Solana system program needed for account creation.
    pub system_program: Program<'info, System>,
}

/// Instruction data expected in create instruction
#[derive(AnchorDeserialize, AnchorSerialize, Clone, Debug)]
#[repr(C)]
pub struct CreateParams {
    /// Timestamp when the tokens start vesting
    pub start_time: u64,
    /// Deposited amount of tokens
    pub net_amount_deposited: u64,
    /// Time step (period) in seconds per which the vesting/release occurs
    pub period: u64,
    /// Amount released per period. Combined with `period`, we get a release rate.
    pub amount_per_period: u64,
    /// Vesting contract "cliff" timestamp
    pub cliff: u64,
    /// Amount unlocked at the "cliff" timestamp
    pub cliff_amount: u64,
    /// Whether or not a stream can be canceled by a sender
    pub cancelable_by_sender: bool,
    /// Whether or not a stream can be canceled by a recipient
    pub cancelable_by_recipient: bool,
    /// Whether or not a 3rd party can initiate withdraw in the name of recipient
    pub automatic_withdrawal: bool,
    /// Whether or not the sender can transfer the stream
    pub transferable_by_sender: bool,
    /// Whether or not the recipient can transfer the stream
    pub transferable_by_recipient: bool,
    /// Whether topup is enabled
    pub can_topup: bool,
    /// The name of this stream
    pub stream_name: [u8; 64],
    /// Withdraw frequency
    pub withdraw_frequency: u64,
}


/// Instruction data expected in the create_unchecked instruction
#[derive(AnchorDeserialize, AnchorSerialize, Clone, Debug)]
#[repr(C)]
pub struct CreateParamsUnchecked {
    /// Timestamp when the tokens start vesting
    pub start_time: u64,
    /// Deposited amount of tokens
    pub net_amount_deposited: u64,
    /// Time step (period) in seconds per which the vesting/release occurs
    pub period: u64,
    /// Amount released per period. Combined with `period`, we get a release rate.
    pub amount_per_period: u64,
    /// Vesting contract "cliff" timestamp
    pub cliff: u64,
    /// Amount unlocked at the "cliff" timestamp
    pub cliff_amount: u64,
    /// Whether or not a stream can be canceled by a sender
    pub cancelable_by_sender: bool,
    /// Whether or not a stream can be canceled by a recipient
    pub cancelable_by_recipient: bool,
    /// Whether or not a 3rd party can initiate withdraw in the name of recipient
    pub automatic_withdrawal: bool,
    /// Whether or not the sender can transfer the stream
    pub transferable_by_sender: bool,
    /// Whether or not the recipient can transfer the stream
    pub transferable_by_recipient: bool,
    /// Whether topup is enabled
    pub can_topup: bool,
    /// The name of this stream
    pub stream_name: [u8; 64],
    /// Withdraw frequency
    pub withdraw_frequency: u64,
    /// Pubkey of the contract recipient
    pub recipient: Pubkey,
    /// Pubkey of the fee partner
    pub partner: Pubkey,
}


/// Instruction data expected in update instruction
#[derive(AnchorDeserialize, AnchorSerialize, Clone, Debug)]
#[repr(C)]
pub struct UpdateParams {
    /// Optionally enable automatic withdrawal
    pub enable_automatic_withdrawal: Option<bool>,
    /// If automatic withdrawal is to be enabled, optionally change withdraw frequency
    pub withdraw_frequency: Option<u64>,
    /// Optionally update amount unlocked per period
    pub amount_per_period: Option<u64>,
}