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

source

pub fn default_for_tests() -> Self

source

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

source

pub fn dynamic_token_vec_offset() -> usize

source

pub fn dynamic_serum3_vec_offset(token_count: u8) -> usize

source

pub fn dynamic_perp_vec_offset(token_count: u8, serum3_count: u8) -> usize

source

pub fn dynamic_perp_oo_vec_offset( token_count: u8, serum3_count: u8, perp_count: u8 ) -> usize

source

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

source§

fn try_deserialize(buf: &mut &[u8]) -> Result<Self>

Deserializes previously initialized account data. Should fail for all uninitialized accounts, where the bytes are zeroed. Implementations should be unique to a particular account type so that one can never successfully deserialize the data of one account type into another. For example, if the SPL token program were to implement this trait, it should be impossible to deserialize a Mint account into a token Account.
source§

fn try_deserialize_unchecked(buf: &mut &[u8]) -> Result<Self>

Deserializes account data without checking the account discriminator. This should only be used on account initialization, when the bytes of the account are zeroed.
source§

impl AccountSerialize for MangoAccount

source§

fn try_serialize<W: Write>(&self, writer: &mut W) -> Result<()>

Serializes the account data into writer.
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,

source§

fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>

Deserializes this instance from a given slice of bytes. Updates the buffer to point at the remaining bytes.
§

fn try_from_slice(v: &[u8]) -> Result<Self, Error>

Deserialize this instance from a slice of bytes.
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,

source§

fn serialize<W: Write>(&self, writer: &mut W) -> Result<(), Error>

§

fn try_to_vec(&self) -> Result<Vec<u8, Global>, Error>

Serialize this instance into a vector of bytes.
source§

impl Clone for MangoAccount

source§

fn clone(&self) -> MangoAccount

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Discriminator for MangoAccount

source§

impl Owner for MangoAccount

source§

fn owner() -> Pubkey

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Az for T

source§

fn az<Dst>(self) -> Dstwhere T: Cast<Dst>,

Casts the value.
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Src, Dst> CastFrom<Src> for Dstwhere Src: Cast<Dst>,

source§

fn cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> CheckedAs for T

source§

fn checked_as<Dst>(self) -> Option<Dst>where T: CheckedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere Src: CheckedCast<Dst>,

source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
source§

impl<T> DynClone for Twhere T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere Dst: LosslessTryFrom<Src>,

source§

fn lossless_try_into(self) -> Option<Dst>

Performs the conversion.
source§

impl<Src, Dst> LossyInto<Dst> for Srcwhere Dst: LossyFrom<Src>,

source§

fn lossy_into(self) -> Dst

Performs the conversion.
source§

impl<T> OverflowingAs for T

source§

fn overflowing_as<Dst>(self) -> (Dst, bool)where T: OverflowingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere Src: OverflowingCast<Dst>,

source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> SaturatingAs for T

source§

fn saturating_as<Dst>(self) -> Dstwhere T: SaturatingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere Src: SaturatingCast<Dst>,

source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> UnwrappedAs for T

source§

fn unwrapped_as<Dst>(self) -> Dstwhere T: UnwrappedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere Src: UnwrappedCast<Dst>,

source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> WrappingAs for T

source§

fn wrapping_as<Dst>(self) -> Dstwhere T: WrappingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere Src: WrappingCast<Dst>,

source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.