Skip to main content

roshi_interface/instructions/
args.rs

1use crate::{action::Ops, oracle::OracleConfig};
2use wincode::{SchemaRead, SchemaWrite};
3
4#[derive(codama_macros::CodamaType, SchemaWrite, SchemaRead)]
5pub struct InitializeProgramArgs {
6    pub authority: [u8; 32],
7}
8
9#[derive(codama_macros::CodamaType, SchemaWrite, SchemaRead)]
10pub struct InitializeVaultArgs {
11    pub tag: [u8; 32],
12    pub tag_len: u8,
13    pub admin: [u8; 32],
14    pub strategist: [u8; 32],
15    pub nav_authority: [u8; 32],
16    pub withdrawal_authority: [u8; 32],
17    pub base_mint: [u8; 32],
18    pub base_decimals: u8,
19    pub base_oracle: OracleConfig,
20    pub deposit_sub_account: u8,
21    pub withdraw_sub_account: u8,
22    pub fee_collector: [u8; 32],
23    pub performance_fee_bps: u16,
24    pub withdrawal_buffer_bps: u16,
25    pub private: bool,
26    pub access_merkle_root: [u8; 32],
27}
28
29#[derive(codama_macros::CodamaType, SchemaWrite, SchemaRead)]
30pub struct AuthorizeActionArgs {
31    pub action_hash: [u8; 32],
32    pub ops: Ops,
33}
34
35#[derive(codama_macros::CodamaType, SchemaWrite, SchemaRead)]
36pub struct RevokeActionArgs {
37    pub action_hash: [u8; 32],
38}
39
40#[derive(Clone, Copy, Debug, Eq, PartialEq, codama_macros::CodamaType, SchemaWrite, SchemaRead)]
41pub struct AccountFlags {
42    pub is_signer: bool,
43    pub is_writable: bool,
44}
45
46#[derive(codama_macros::CodamaType, SchemaWrite, SchemaRead)]
47pub struct ManageArgs {
48    pub sub_account: u8,
49    pub program_id: [u8; 32],
50    pub accounts_start: u8,
51    pub accounts_len: u8,
52    pub account_flags: Vec<AccountFlags>,
53    pub ix_data: Vec<u8>,
54}
55
56#[derive(codama_macros::CodamaType, SchemaWrite, SchemaRead)]
57pub struct ManageBatchArgs {
58    pub actions: Vec<ManageArgs>,
59}
60
61#[derive(codama_macros::CodamaType, SchemaWrite, SchemaRead)]
62pub struct DepositArgs {
63    pub asset_mint: [u8; 32],
64    pub amount: u64,
65    pub min_shares_out: u64,
66    pub access_proof: Vec<[u8; 32]>,
67}
68
69#[derive(codama_macros::CodamaType, SchemaWrite, SchemaRead)]
70pub struct RedeemArgs {
71    pub recipient_token_account: [u8; 32],
72    pub ticket_index: u8,
73    pub shares: u64,
74}
75
76#[derive(codama_macros::CodamaType, SchemaWrite, SchemaRead)]
77pub struct CancelRedeemArgs {
78    pub min_shares_out: u64,
79}
80
81#[derive(codama_macros::CodamaType, SchemaWrite, SchemaRead)]
82pub struct ProcessWithdrawalsArgs;
83
84#[derive(codama_macros::CodamaType, SchemaWrite, SchemaRead)]
85pub struct CollectFeesArgs {
86    pub sub_account: u8,
87    pub amount: u64,
88}
89
90#[derive(codama_macros::CodamaType, SchemaWrite, SchemaRead)]
91pub struct ReportNavArgs {
92    pub total_assets: u64,
93    pub report_hash: [u8; 32],
94}
95
96#[derive(codama_macros::CodamaType, SchemaWrite, SchemaRead)]
97pub struct UpdateVaultConfigArgs {
98    pub fee_collector: [u8; 32],
99    pub deposit_sub_account: u8,
100    pub withdraw_sub_account: u8,
101    pub base_oracle: OracleConfig,
102    pub performance_fee_bps: u16,
103    pub withdrawal_buffer_bps: u16,
104}
105
106#[derive(codama_macros::CodamaType, SchemaWrite, SchemaRead)]
107pub struct InitializeAssetArgs {
108    pub asset_mint: [u8; 32],
109    pub oracle: OracleConfig,
110    pub asset_decimals: u8,
111    pub enabled: bool,
112}
113
114#[derive(codama_macros::CodamaType, SchemaWrite, SchemaRead)]
115pub struct UpdateAssetArgs {
116    pub oracle: OracleConfig,
117    pub enabled: bool,
118}
119
120#[derive(codama_macros::CodamaType, SchemaWrite, SchemaRead)]
121pub struct SetPauseFlagsArgs {
122    pub deposits_paused: bool,
123    pub withdrawals_paused: bool,
124    pub manage_paused: bool,
125}
126
127#[derive(codama_macros::CodamaType, SchemaWrite, SchemaRead)]
128pub struct SetVaultAccessArgs {
129    pub private: bool,
130    pub access_merkle_root: [u8; 32],
131}
132
133#[derive(codama_macros::CodamaType, SchemaWrite, SchemaRead)]
134pub struct TransferProgramAuthorityArgs {
135    pub new_authority: [u8; 32],
136}
137
138#[derive(codama_macros::CodamaType, SchemaWrite, SchemaRead)]
139pub struct TransferVaultAuthorityArgs {
140    pub new_authority: [u8; 32],
141}
142
143#[derive(codama_macros::CodamaType, SchemaWrite, SchemaRead)]
144pub struct SetStrategistArgs {
145    pub strategist: [u8; 32],
146}
147
148#[derive(codama_macros::CodamaType, SchemaWrite, SchemaRead)]
149pub struct SetNavAuthorityArgs {
150    pub nav_authority: [u8; 32],
151}
152
153#[derive(codama_macros::CodamaType, SchemaWrite, SchemaRead)]
154pub struct SetWithdrawalAuthorityArgs {
155    pub withdrawal_authority: [u8; 32],
156}