Struct mango_v4::state::MangoAccount
source · pub struct MangoAccount {Show 27 fields
pub group: Pubkey,
pub owner: Pubkey,
pub name: [u8; 32],
pub delegate: Pubkey,
pub account_num: u32,
pub being_liquidated: u8,
pub in_health_region: u8,
pub bump: u8,
pub padding: [u8; 1],
pub net_deposits: i64,
pub perp_spot_transfers: i64,
pub health_region_begin_init_health: i64,
pub frozen_until: u64,
pub buyback_fees_accrued_current: u64,
pub buyback_fees_accrued_previous: u64,
pub buyback_fees_expiry_timestamp: u64,
pub reserved: [u8; 208],
pub header_version: u8,
pub padding3: [u8; 7],
pub padding4: u32,
pub tokens: Vec<TokenPosition>,
pub padding5: u32,
pub serum3: Vec<Serum3Orders>,
pub padding6: u32,
pub perps: Vec<PerpPosition>,
pub padding7: u32,
pub perp_open_orders: Vec<PerpOpenOrder>,
}
Fields§
§group: Pubkey
§owner: Pubkey
§name: [u8; 32]
§delegate: Pubkey
§account_num: u32
§being_liquidated: u8
Tracks that this account should be liquidated until init_health >= 0.
Normally accounts can not be liquidated while maint_health >= 0. But when an account reaches maint_health < 0, liquidators will call a liquidation instruction and thereby set this flag. Now the account may be liquidated until init_health >= 0.
Many actions should be disabled while the account is being liquidated, even if its maint health has recovered to positive. Creating new open orders would, for example, confuse liquidators.
in_health_region: u8
The account is currently inside a health region marked by HealthRegionBegin…HealthRegionEnd.
Must never be set after a transaction ends.
bump: u8
§padding: [u8; 1]
§net_deposits: i64
§perp_spot_transfers: i64
§health_region_begin_init_health: i64
Init health as calculated during HealthReginBegin, rounded up.
frozen_until: u64
§buyback_fees_accrued_current: u64
Fees usable with the “fees buyback” feature. This tracks the ones that accrued in the current expiry interval.
buyback_fees_accrued_previous: u64
Fees buyback amount from the previous expiry interval.
buyback_fees_expiry_timestamp: u64
End timestamp of the current expiry interval of the buyback fees amount.
reserved: [u8; 208]
§header_version: u8
§padding3: [u8; 7]
§padding4: u32
§tokens: Vec<TokenPosition>
§padding5: u32
§serum3: Vec<Serum3Orders>
§padding6: u32
§perps: Vec<PerpPosition>
§padding7: u32
§perp_open_orders: Vec<PerpOpenOrder>
Implementations§
source§impl MangoAccount
impl MangoAccount
pub fn default_for_tests() -> Self
sourcepub fn space(
token_count: u8,
serum3_count: u8,
perp_count: u8,
perp_oo_count: u8
) -> Result<usize>
pub fn space( token_count: u8, serum3_count: u8, perp_count: u8, perp_oo_count: u8 ) -> Result<usize>
Number of bytes needed for the MangoAccount, including the discriminator
pub fn dynamic_token_vec_offset() -> usize
pub fn dynamic_serum3_vec_offset(token_count: u8) -> usize
pub fn dynamic_perp_vec_offset(token_count: u8, serum3_count: u8) -> usize
pub fn dynamic_perp_oo_vec_offset( token_count: u8, serum3_count: u8, perp_count: u8 ) -> usize
pub fn dynamic_size( token_count: u8, serum3_count: u8, perp_count: u8, perp_oo_count: u8 ) -> usize
Trait Implementations§
source§impl AccountDeserialize for MangoAccount
impl AccountDeserialize for MangoAccount
source§fn try_deserialize(buf: &mut &[u8]) -> Result<Self>
fn try_deserialize(buf: &mut &[u8]) -> Result<Self>
Mint
account into a token
Account
.source§fn try_deserialize_unchecked(buf: &mut &[u8]) -> Result<Self>
fn try_deserialize_unchecked(buf: &mut &[u8]) -> Result<Self>
source§impl AccountSerialize for MangoAccount
impl AccountSerialize for MangoAccount
source§impl BorshDeserialize for MangoAccountwhere
Pubkey: BorshDeserialize,
[u8; 32]: BorshDeserialize,
u32: BorshDeserialize,
u8: BorshDeserialize,
[u8; 1]: BorshDeserialize,
i64: BorshDeserialize,
u64: BorshDeserialize,
[u8; 208]: BorshDeserialize,
[u8; 7]: BorshDeserialize,
Vec<TokenPosition>: BorshDeserialize,
Vec<Serum3Orders>: BorshDeserialize,
Vec<PerpPosition>: BorshDeserialize,
Vec<PerpOpenOrder>: BorshDeserialize,
impl BorshDeserialize for MangoAccountwhere Pubkey: BorshDeserialize, [u8; 32]: BorshDeserialize, u32: BorshDeserialize, u8: BorshDeserialize, [u8; 1]: BorshDeserialize, i64: BorshDeserialize, u64: BorshDeserialize, [u8; 208]: BorshDeserialize, [u8; 7]: BorshDeserialize, Vec<TokenPosition>: BorshDeserialize, Vec<Serum3Orders>: BorshDeserialize, Vec<PerpPosition>: BorshDeserialize, Vec<PerpOpenOrder>: BorshDeserialize,
source§impl BorshSerialize for MangoAccountwhere
Pubkey: BorshSerialize,
[u8; 32]: BorshSerialize,
u32: BorshSerialize,
u8: BorshSerialize,
[u8; 1]: BorshSerialize,
i64: BorshSerialize,
u64: BorshSerialize,
[u8; 208]: BorshSerialize,
[u8; 7]: BorshSerialize,
Vec<TokenPosition>: BorshSerialize,
Vec<Serum3Orders>: BorshSerialize,
Vec<PerpPosition>: BorshSerialize,
Vec<PerpOpenOrder>: BorshSerialize,
impl BorshSerialize for MangoAccountwhere Pubkey: BorshSerialize, [u8; 32]: BorshSerialize, u32: BorshSerialize, u8: BorshSerialize, [u8; 1]: BorshSerialize, i64: BorshSerialize, u64: BorshSerialize, [u8; 208]: BorshSerialize, [u8; 7]: BorshSerialize, Vec<TokenPosition>: BorshSerialize, Vec<Serum3Orders>: BorshSerialize, Vec<PerpPosition>: BorshSerialize, Vec<PerpOpenOrder>: BorshSerialize,
source§impl Clone for MangoAccount
impl Clone for MangoAccount
source§fn clone(&self) -> MangoAccount
fn clone(&self) -> MangoAccount
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more