Friktion
Search…
⌃K

Global Accounts

VoltVault:
primary metadata account for a volt. includes:
  • deposit token mint
  • fee rates
  • capacities (individual and global).
  • strategy parameters
  • boolean FSM fields
  • Account validation public keys
pub struct VoltVault {
// permissioned instructions
pub admin_key: Pubkey,
pub seed: Pubkey,
///////// time windows ///////////
// length of withdrawal window in seconds
pub transfer_window: u64,
// time at which withdrawals began
pub start_transfer_time: u64,
// minimum time at which withdrawals end
pub end_transfer_time: u64,
///////// rebalance pipeline state ///////////
// has vault been initialized?
pub initialized: bool,
// has the current/previous options position been settled?
// settlement is defined as having all AUM of this volt stored in one asset (underlying)
pub curr_option_was_settled: bool,
// do we have to swap premium to underlying before entering position?
pub must_swap_premium_to_underlying: bool,
// has the next option to roll into been set?
pub next_option_was_set: bool,
// has set_next_option been called successfully a single time yet?
pub first_ever_option_was_set: bool,
// should deposit/withdraw still be validly callable?
pub instant_transfers_enabled: bool,
// has rebalance prepare been called this cycle?
pub prepare_is_finished: bool,
// are we out of options to sell in the rebalance enter stage of this cycle?
pub enter_is_finished: bool,
// has the current round started?
pub round_has_started: bool,
// round number of roll. increments post-settlement (maybe set next option)
pub round_number: u64,
////// Rewards Tracking //////
// total amount in vault when set next option was last called
pub total_underlying_pre_enter: u64,
// total amount in vault immediately following full settlement
pub total_underlying_post_settle: u64,
// total number of volt tokens in supply post settlement
// used for calculating share of pnl
pub total_volt_tokens_post_settle: u64,
///////// accounts to save here so others can read. additionally for account_validators.rs ///////////
pub vault_authority: Pubkey,
// pools
pub deposit_pool: Pubkey,
pub premium_pool: Pubkey,
pub option_pool: Pubkey,
pub writer_token_pool: Pubkey,
// mints
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,
///////// vault strategy params ///////////
// integer describing the vault strategy
pub vault_type: u64,
/// The amount of the **underlying asset** that derives a single option
pub underlying_amount_per_contract: u64,
// strike * underlying per contract
pub quote_amount_per_contract: u64,
/// The Unix timestamp at which the contracts in this market expire
pub expiration_unix_timestamp: i64,
// exact expiry length the target option should have, except for the initial option
pub expiration_interval: u64,
// option is assumed to be OTM. this limits how high the strike can be relative to current underlying price.
// i.e, new strike must be less than or equal to (underlying price * upper_bound_otm_strike_factor)
pub upper_bound_otm_strike_factor: u64,
/// A flag to set and use to when running a memcmp query.
/// This will be set when Serum markets are closed and expiration is validated
pub have_taken_withdrawal_fees: bool,
///////// serum ///////////
pub serum_spot_market: Pubkey,
// bump for program address of open orders account (serum)
pub open_orders_bump: u8,
// bump for serum (unknown)
pub open_orders_init_bump: u8,
// bump for open orders for underlying serum market
pub ul_open_orders_bump: u8,
// open orders account for underlying spot market
pub ul_open_orders: Pubkey,
// was the ul open orders acct already initialized?
pub ul_open_orders_initialized: bool,
// bump for vault authority, used to generate signer seeds for CPI calls
pub bump_authority: u8,
// order size in # contracts to sell options
pub serum_order_size_options: u64,
// order size in # contracts to sell options
pub individual_capacity: u64,
// type of order to submit (limit, postonly, IOC)
pub serum_order_type: u64,
pub serum_limit: u16,
// specifies what serum should do if the order is matched w/ an order from the same account
pub serum_self_trade_behavior: u16,
// order ID to use when sending a serum order. should be incremented following each succesful order
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,
}
ExtraVoltData:
secondary metadata account (created before reallocs) for:
  • Additional strategy parameters
  • whitelisting
  • DAO/Realms integration
  • defcon-5 failsafe booleans (e.g indicating if deposit/withdraws should be disabled) validation public keys
  • More account validation public keys
pub struct ExtraVoltData {
pub is_whitelisted: bool, // 1
pub whitelist: Pubkey,
pub is_for_dao: bool,
pub dao_program_id: Pubkey,
// spl mint of deposit token
pub deposit_mint: Pubkey,
// target leverage amount (as ratio) for the position (for each rebalance)
pub target_leverage: f64,
// defines width of interval collateralization ratio at end of round must lie within
pub target_leverage_lenience: f64,
// leverage threshold for calling exit_early instructoin
pub exit_early_ratio: f64,
// is this trading on mango or entropy?
pub entropy_program_id: Pubkey,
// group the protocol trades on
pub entropy_group: Pubkey,
// account the program initializes to trade with
pub entropy_account: Pubkey,
// pubkey of perp market to trade
pub power_perp_market: Pubkey,
// true after settle_deposits was called successfully for current round
pub have_resolved_deposits: bool,
// true after obtained target collateralization, ready to end round
pub done_rebalancing: bool,
pub dao_authority: Pubkey,
pub serum_program_id: Pubkey,
pub entropy_cache: Pubkey,
/// pubkey of perp market to hedge
pub hedging_spot_perp_market: Pubkey,
pub entropy_metadata: Pubkey,
pub hedging_spot_market: Pubkey,
pub auction_metadata: Pubkey,
pub extra_key_10: Pubkey,
pub extra_key_11: Pubkey,
pub extra_key_12: Pubkey,
pub extra_key_13: Pubkey,
pub extra_key_14: Pubkey,
pub unused_uint_one: u64,
pub max_quote_pos_change: u64,
// defines width of dollar delta range hedge must lie within
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 use_custom_fees: u64,
pub performance_fee_bps: u64, //
pub withdrawal_fee_bps: u64,
pub turn_off_deposits_and_withdrawals: bool, //
pub rebalance_is_ready: bool, //
pub dov_performance_fees_in_underlying: bool, //
pub done_rebalancing_power_perp: bool, //
pub is_hedging_on: bool, //
pub have_taken_performance_fees: bool,
}
Round:
Primary account containing information for a single epoch. PDA account derived from the volt and the number assigned to the current epoch. Primary purpose is to track the number of underlying tokens deposited and fTokens (volt tokens) burned in an epoch. Whenever a deposit succeeds, underlying_from_pending_deposits is incremented by the number of underlying tokens deposited. Whenever a withdrawal succeeds, volt_tokens_from_pending_withdrawals is incremented by the number of tokens burned.
/**
* Epoch-specific PDA. Stores all information specific to that epoch.
* New rounds are initialized in start_round.
* Modified in deposit, withdraw, claim_pending, claim_pending_withdrawal
*/
pub struct Round {
// numerical ranking of this round. round numbers start at 1, and are incremented
// following each successful call of start_round
pub number: u64,
// total # of underlying from pending deposits created during this round.
// NOTE: this has to be stored in the Round account in order to calculate correct
// proportion of vault tokens for each user in claim_pending
pub underlying_from_pending_deposits: u64,
// total # of volt tokens from pending withdrawals created during this round.
// NOTE: this has to be stored in the Round account in order to calculate correct
// proportion of underlying tokens for each user in claim_pending_withdrawal
pub volt_tokens_from_pending_withdrawals: u64,
pub underlying_pre_enter: u64,
pub underlying_post_settle: u64,
pub premium_farmed: u64,
// pub unused_space: [u64; 7],
}
FriktionEpochInfo:
Secondary account for epoch-specific information:
  • vault token price at start of epoch
  • pnl in underlying, USDC, %
  • TVL at start and end of epoch
  • number of volt tokens in circulation at start of epoch
  • total fees collected
  • number of deposits & withdrawals
    • instant
    • pending
    • from realms
  • start/end time of auctions
pub struct FriktionEpochInfo {
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 dao_deposits: 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 start_round_time: u64,
pub begin_auction_time: u64,
pub end_auction_time: u64,
pub unused_uint_7: u64,
pub unused_uint_8: u64,
pub unused_uint_9: u64,
pub unused_uint_10: u64,
pub total_withdrawals_from_realms: u64,
pub total_deposits_from_realms: u64,
pub dov_performance_fees_in_underlying: 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,
}
AuctionMetadata:
Auction-specific metadata:
  • Should be permissionless?
  • ...
pub struct AuctionMetadata {
pub is_permissionless: bool,
pub unused_bool_one: bool,
pub unused_bool_two: bool,
pub unused_bool_three: bool,
pub unused_bool_four: bool,
pub extra_key_9: Pubkey,
pub extra_key_10: Pubkey,
pub extra_key_11: Pubkey,
pub extra_key_12: Pubkey,
pub extra_key_13: Pubkey,
pub extra_key_14: Pubkey,
pub unused_uint_one: u64,
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_float_one: f64,
pub unused_float_four: f64,
pub unused_float_five: f64,
pub unused_float_six: f64,
}