Skip to main content

roshi_interface/instructions/
args.rs

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