1use anchor_lang::prelude::*;
2
3#[account]
4#[derive(Default)]
5pub struct Whitelist {
6 pub admin: Pubkey,
7
8 pub addresses: Vec<Pubkey>,
10}
11
12#[account]
13#[derive(Default)]
14pub struct PendingDeposit {
22 pub initialized: bool,
24
25 pub round_number: u64,
28
29 pub num_underlying_deposited: u64,
33}
34
35impl PendingDeposit {
36 pub const LEN: usize = 17;
37}
38
39#[account]
40#[derive(Default)]
41pub struct PendingWithdrawal {
49 pub initialized: bool,
51
52 pub round_number: u64,
55
56 pub num_volt_redeemed: u64,
60}
61
62impl PendingWithdrawal {
63 pub const LEN: usize = 17;
64}
65
66#[account]
67#[derive(Default)]
68pub struct UlOpenOrdersMetadata {
69 initialized: bool, }
71
72impl UlOpenOrdersMetadata {
73 pub const LEN: usize = 1;
74}
75
76#[account]
77#[derive(Default, PartialEq, Debug)]
78pub struct EntropyRound {
79 pub instant_deposits_native: u64,
80 pub prev_entropy_account_deposits: u64,
81 pub initial_equity: f64, pub new_equity_post_deposit: f64, pub deposit_amt: f64, pub withdraw_comp_from_deposit: u64, pub net_deposits: f64, pub deposit_amt_native: u64, pub withdraw_amt_native: u64, pub total_volt_supply: u64,
89 pub oracle_price: f64,
90
91 pub acct_equity_start: f64,
92 pub acct_equity_before_next_rebalance: f64,
93 pub pnl_quote: f64,
94 pub performance_fees_quote: f64,
95
96 pub temp1: Pubkey, pub temp2: Pubkey, pub temp3: Pubkey, pub extra_key_11: Pubkey, pub extra_key_12: Pubkey, pub unused_uint_four: u64, pub unused_uint_five: u64, pub unused_uint_six: u64, pub unused_uint_12: u64, pub unused_float1: f64, pub unused_float2: f64, pub unused_float3: f64, pub unused_float4: f64, pub unused_bool_one: bool, pub unused_bool_two: bool, pub unused_bool_three: bool, pub unused_bool_four: bool,
116}
117
118impl EntropyRound {
119 pub const LEN: usize = 348;
120}
121
122#[account]
123#[derive(Default)]
124pub struct Round {
130 pub number: u64,
133
134 pub underlying_from_pending_deposits: u64,
138
139 pub volt_tokens_from_pending_withdrawals: u64,
143
144 pub underlying_pre_enter: u64,
145
146 pub underlying_post_settle: u64,
147
148 pub premium_farmed: u64,
149 }
151
152impl Round {
153 pub const LEN: usize = 48;
154}
155
156#[account]
157#[derive(Default)]
158pub struct FriktionEpochInfo {
159 pub vault_token_price: f64, pub pct_pnl: f64, pub number: u64, pub underlying_pre_enter: u64, pub underlying_post_settle: u64, pub volt_token_supply: u64, pub pnl: i64, pub performance_fees: u64, pub withdrawal_fees: u64, pub pending_deposits: u64, pub pending_withdrawals_volt_tokens: u64, pub pending_withdrawals: u64, pub canceled_withdrawals: u64, pub canceled_deposits: u64, pub total_withdrawals: u64, pub total_deposits: u64, pub instant_deposits: u64, pub instant_withdrawals: u64, pub unused_uint_1: u64, pub minted_options: u64, pub enter_num_times_called: u64, pub swap_premium_num_times_called: u64, pub option_key: Pubkey, pub extra_key_four: Pubkey, pub extra_key_5: Pubkey, pub extra_key_6: Pubkey, pub extra_key_7: Pubkey, pub extra_key_8: Pubkey, pub extra_key_9: Pubkey, pub extra_key_10: Pubkey, pub extra_key_11: Pubkey, pub extra_key_12: Pubkey, pub unused_uint_four: u64, pub unused_uint_five: u64, pub unused_uint_six: u64, pub unused_uint_7: u64, pub unused_uint_8: u64, pub unused_uint_9: u64, pub unused_uint_10: u64, pub unused_uint_11: u64, pub unused_uint_12: u64, pub unused_bool_one: bool, pub unused_bool_two: bool, pub unused_bool_three: bool, pub unused_bool_four: bool, pub unused_bool_five: bool, pub unused_bool_six: bool, }
217
218impl FriktionEpochInfo {
219 pub const LEN: usize = 574;
220}
221
222#[account]
223#[derive(Default, Debug)]
224pub struct EntropyMetadata {
225 pub target_hedge_ratio: f64,
227
228 pub rebalancing_lenience: f64,
229
230 pub required_basis_from_oracle: f64,
232
233 pub extra_key_3: Pubkey, pub extra_key_4: Pubkey, pub extra_key_5: Pubkey, pub extra_key_6: Pubkey, pub extra_key_7: Pubkey, pub extra_key_8: Pubkey, pub extra_key_9: Pubkey, pub extra_key_10: Pubkey, pub extra_key_11: Pubkey, pub extra_key_12: Pubkey, pub unused_uint_four: u64, pub unused_uint_five: u64, pub unused_uint_six: u64, pub unused_uint_12: u64, pub unused_uint_123: u64, pub unused_uint_456: u64, pub unused_uint_789: u64, pub unused_uint_102: u64, pub unused_float1: f64, pub unused_float2: f64, pub unused_float3: f64, pub unused_float4: f64, pub unused_float5: f64, pub unused_float6: f64, pub unused_float7: f64, pub unused_float8: f64, pub unused_float9: f64, pub unused_float10: f64, pub unused_float11: f64, pub unused_float12: f64, pub unused_bool_one: bool, pub unused_bool_two: bool, pub unused_bool_three: bool, pub unused_bool_four: bool,
270 pub unused_bool_five: bool, pub unused_bool_six: bool, pub unused_bool_seven: bool, pub unused_bool_eight: bool,
274 pub unused_bool_nine: bool, pub unused_bool_ten: bool,
276
277 pub vault_name: String,
278}
279
280impl EntropyMetadata {
281 pub const LEN: usize = 512 + 30;
282}
283
284#[account]
285#[derive(Default, Copy, Debug)]
286pub struct ExtraVoltData {
287 pub is_whitelisted: bool, pub whitelist: Pubkey, pub is_for_dao: bool, pub dao_program_id: Pubkey, pub deposit_mint: Pubkey, pub target_leverage: f64, pub target_leverage_lenience: f64, pub exit_early_ratio: f64, pub entropy_program_id: Pubkey, pub entropy_group: Pubkey, pub entropy_account: Pubkey, pub power_perp_market: Pubkey, pub have_resolved_deposits: bool, pub done_rebalancing: bool, pub non_payer_authority: Pubkey, pub serum_program_id: Pubkey, pub entropy_cache: Pubkey, pub spot_perp_market: Pubkey, pub extra_key_7: Pubkey, pub extra_key_8: Pubkey, pub extra_key_9: Pubkey, pub extra_key_10: Pubkey, pub extra_key_11: Pubkey, pub extra_key_12: Pubkey,
336 pub extra_key_13: Pubkey,
337 pub extra_key_14: Pubkey, pub net_withdrawals: u64, pub max_quote_pos_change: u64, pub target_hedge_lenience: f64, pub unused_uint_four: u64, pub unused_uint_five: u64, pub unused_uint_six: u64, pub unused_uint_7: u64, pub unused_uint_8: u64, pub unused_uint_9: u64, pub unused_uint_10: u64, pub unused_uint_11: u64, pub unused_uint_12: u64, pub turn_off_deposits_and_withdrawals: bool, pub rebalance_is_ready: bool, pub unused_bool1234: bool, pub done_rebalancing_power_perp: bool, pub is_hedging_on: bool, pub have_taken_performance_fees: bool, }
360
361impl ExtraVoltData {
362 pub const LEN: usize = 738;
363}
364
365#[account]
366#[derive(Default, Copy, Debug)]
367pub struct VoltVault {
368 pub admin_key: Pubkey, pub seed: Pubkey, pub transfer_window: u64, pub start_transfer_time: u64, pub end_transfer_time: u64, pub initialized: bool, pub curr_option_was_settled: bool, pub must_swap_premium_to_underlying: bool, pub next_option_was_set: bool, pub first_ever_option_was_set: bool, pub instant_transfers_enabled: bool, pub prepare_is_finished: bool, pub enter_is_finished: bool, pub round_has_started: bool, pub round_number: u64, pub total_underlying_pre_enter: u64, pub total_underlying_post_settle: u64, pub total_volt_tokens_post_settle: u64, pub vault_authority: Pubkey, pub deposit_pool: Pubkey, pub premium_pool: Pubkey, pub option_pool: Pubkey, pub writer_token_pool: Pubkey, pub vault_mint: Pubkey, pub underlying_asset_mint: Pubkey, pub quote_asset_mint: Pubkey, pub option_mint: Pubkey, pub writer_token_mint: Pubkey, pub option_market: Pubkey, pub vault_type: u64, pub underlying_amount_per_contract: u64, pub quote_amount_per_contract: u64, pub expiration_unix_timestamp: i64, pub expiration_interval: u64, pub upper_bound_otm_strike_factor: u64, pub have_taken_withdrawal_fees: bool, pub serum_spot_market: Pubkey, pub open_orders_bump: u8, pub open_orders_init_bump: u8, pub ul_open_orders_bump: u8, pub ul_open_orders: Pubkey, pub ul_open_orders_initialized: bool, pub bump_authority: u8, pub serum_order_size_options: u64, pub individual_capacity: u64, pub serum_order_type: u64, pub serum_limit: u16, pub serum_self_trade_behavior: u16, pub serum_client_order_id: u64, pub whitelist_token_mint: Pubkey, pub permissioned_market_premium_mint: Pubkey, pub permissioned_market_premium_pool: Pubkey, pub capacity: u64, }
538
539impl VoltVault {
540 pub const LEN: usize = 739;
541}
542
543#[account]
544#[derive(Debug)]
545pub struct PrincipalProtectionVaultV1 {
546 pub initialized: bool,
547
548 pub vault_name: String,
549
550 pub keys: PrincipalProtectionAccountsV1,
552
553 pub allocation_strategy: SecondLegAllocationStrategy,
554 pub lending_strategy: LendingStrategy,
555 }
564
565impl PrincipalProtectionVaultV1 {
566 pub const LEN: usize = 1 + 25 + PrincipalProtectionAccountsV1::LEN
568 + 1 + 8 + 1 + LendingParams::LEN + 8192;
572
573 pub fn get_underlying_deposit_queue(&self) -> Pubkey {
574 self.get_primary_lending_vault_keys()
575 .underlying_deposit_queue
576 }
577
578 pub fn get_underlying_withdraw_queue(&self) -> Pubkey {
579 self.get_primary_lending_vault_keys()
580 .underlying_withdraw_queue
581 }
582
583 pub fn get_primary_lending_vault_keys(&self) -> &PrimaryVaultKeys {
584 &self.keys.lending_keys.primary_vault
585 }
586
587 pub fn get_primary_lending_vault_pda(&self) -> Pubkey {
588 self.get_primary_lending_vault_keys().vault_pda
589 }
590
591 pub fn get_lending_shares_pool(&self) -> Pubkey {
592 self.keys.lending_shares_pool
593 }
594
595 pub fn get_deposit_into_lending_ata(&self) -> Pubkey {
596 self.keys.deposit_into_lending_ata
597 }
598
599 pub fn get_shares_mint(&self) -> Pubkey {
600 self.keys.lending_keys.primary_vault.shares_mint
601 }
602
603 pub fn get_option_token_pool(&self) -> Pubkey {
604 self.keys.options_keys.option_token_pool
605 }
606
607 pub fn get_deposit_tracking_pda(&self) -> Pubkey {
608 self.keys.lending_keys.primary_vault.deposit_tracking_pda
609 }
610
611 pub fn get_deposit_tracking_account(&self) -> Pubkey {
612 self.keys
613 .lending_keys
614 .primary_vault
615 .deposit_tracking_account
616 }
617
618 pub fn get_primary_lending_vault_pk(&self) -> Pubkey {
619 self.get_primary_lending_vault_keys().vault
620 }
621
622 pub fn get_primary_lending_vault_program_id(&self) -> Pubkey {
623 self.get_primary_lending_vault_keys().program_id
624 }
625}
626
627#[derive(AnchorSerialize, AnchorDeserialize, Clone, Copy, Debug)]
639pub struct PrincipalProtectionAccountsV1 {
640 pub lending_keys: LendingKeys,
641 pub options_keys: OptionsContractKeys,
642 pub lending_shares_pool: Pubkey,
643 pub deposit_into_lending_ata: Pubkey,
644 pub extra_key1: Pubkey,
645 pub extra_key2: Pubkey,
646 pub extra_key3: Pubkey,
647 pub extra_key4: Pubkey,
648 pub extra_key5: Pubkey,
649 pub extra_key6: Pubkey,
650 pub extra_key7: Pubkey,
651}
652
653impl PrincipalProtectionAccountsV1 {
654 pub const LEN: usize = std::mem::size_of::<PrincipalProtectionAccountsV1>();
657}
658
659#[derive(AnchorSerialize, AnchorDeserialize, Clone, Copy, Debug)]
670
671pub struct OptionsContractKeys {
672 pub program_id: Pubkey,
673 pub options_contract: Pubkey,
674 pub option_token_pool: Pubkey,
675
676 pub extra_key1: Pubkey,
677 pub extra_key2: Pubkey,
678 pub extra_key3: Pubkey,
679 pub extra_key4: Pubkey,
680}
681
682#[derive(AnchorSerialize, AnchorDeserialize, Clone, Copy, Debug, PartialEq)]
683pub enum SecondLegAllocationStrategy {
684 MinApr {
686 apr: u64,
687 },
688 ProjectedPnlFraction {
690 fraction_bps: u64,
691 },
692 FixedFraction {
694 fraction_bps: u64,
695 },
696
697 ExtraStrategy1 {
698 uint1: u64,
699 uint2: u64,
700 uint3: u64,
701 uint4: u64,
702 u81: u8,
703 u82: u8,
704 u83: u8,
705 u84: u8,
706 },
707}
708
709#[derive(AnchorSerialize, AnchorDeserialize, Clone, Copy, Debug, Default, PartialEq)]
710
711pub struct LendingParams {
712 pub bool1: u8,
713 pub bool2: u8,
714 pub bool3: u8,
715 pub bool4: u8,
716 pub max_allowed_utilization_bps: u64,
717 pub unused_uint1: u64,
718 pub unused_uint2: u64,
719 pub unused_uint3: u64,
720 pub unused_uint4: u64,
721 pub unused_float1: f64,
722 pub unused_float2: f64,
723 pub unused_float3: f64,
724 pub unused_float4: f64,
725}
726
727impl LendingParams {
728 pub const LEN: usize = std::mem::size_of::<LendingParams>();
729}
730
731#[derive(AnchorSerialize, AnchorDeserialize, Clone, Copy, Debug, PartialEq)]
732
733pub enum LendingStrategy {
734 TulipOptimizer { params: LendingParams },
735}
736
737#[derive(AnchorSerialize, AnchorDeserialize, Clone, Copy, Debug, PartialEq)]
738pub struct PrimaryVaultKeys {
739 pub vault: Pubkey,
740 pub vault_pda: Pubkey,
741 pub underlying_deposit_queue: Pubkey,
743 pub underlying_withdraw_queue: Pubkey,
744
745 pub shares_mint: Pubkey,
746 pub underlying_mint: Pubkey,
747
748 pub deposit_tracking_account: Pubkey,
749 pub deposit_tracking_queue_account: Pubkey,
750 pub deposit_tracking_hold_account: Pubkey,
751 pub deposit_tracking_pda: Pubkey,
752
753 pub program_id: Pubkey,
754
755 pub extra_key_1: Pubkey,
756 pub extra_key_2: Pubkey,
757 pub extra_key_3: Pubkey,
758 pub extra_key_4: Pubkey,
759 pub extra_key_5: Pubkey,
760 pub extra_key_6: Pubkey,
761 }
764
765#[derive(AnchorSerialize, AnchorDeserialize, Clone, Copy, Debug, PartialEq)]
766pub struct LendingKeys {
767 pub primary_vault: PrimaryVaultKeys,
769 pub mango_vault: Pubkey,
770 pub solend_vault: Pubkey,
771 pub tulip_vault: Pubkey,
772}