Struct jet_margin::AccountPosition
source · [−]#[repr(C)]pub struct AccountPosition {Show 13 fields
pub token: Pubkey,
pub address: Pubkey,
pub adapter: Pubkey,
pub value: [u8; 16],
pub balance: u64,
pub balance_timestamp: u64,
pub price: PriceInfo,
pub kind: u32,
pub exponent: i16,
pub value_modifier: u16,
pub max_staleness: u64,
pub flags: AdapterPositionFlags,
pub _reserved: [u8; 23],
}
Fields
token: Pubkey
The address of the token/mint of the asset
address: Pubkey
The address of the account holding the tokens.
adapter: Pubkey
The address of the adapter managing the asset
value: [u8; 16]
The current value of this position, stored as a Number128
with fixed precision.
balance: u64
The amount of tokens in the account
balance_timestamp: u64
The timestamp of the last balance update
price: PriceInfo
The current price/value of each token
kind: u32
The kind of balance this position contains
exponent: i16
The exponent for the token value
value_modifier: u16
A weight on the value of this asset when counting collateral
max_staleness: u64
The max staleness for the account balance (seconds)
flags: AdapterPositionFlags
Flags that are set by the adapter
_reserved: [u8; 23]
Unused
Implementations
sourceimpl AccountPosition
impl AccountPosition
pub fn kind(&self) -> TokenKind
pub fn calculate_value(&mut self)
pub fn value(&self) -> Number128
pub fn collateral_value(&self) -> Number128
pub fn required_collateral_value(&self) -> Number128
sourcepub fn set_balance(&mut self, balance: u64)
pub fn set_balance(&mut self, balance: u64)
Update the balance for this position
sourcepub fn set_price(&mut self, price: &PriceInfo) -> Result<(), ErrorCode>
pub fn set_price(&mut self, price: &PriceInfo) -> Result<(), ErrorCode>
Update the price for this position
pub fn may_be_registered_or_closed(&self, approvals: &[Approver]) -> bool
Trait Implementations
sourceimpl BorshDeserialize for AccountPositionwhere
Pubkey: BorshDeserialize,
Pubkey: BorshDeserialize,
Pubkey: BorshDeserialize,
[u8; 16]: BorshDeserialize,
u64: BorshDeserialize,
u64: BorshDeserialize,
PriceInfo: BorshDeserialize,
u32: BorshDeserialize,
i16: BorshDeserialize,
u16: BorshDeserialize,
u64: BorshDeserialize,
AdapterPositionFlags: BorshDeserialize,
[u8; 23]: BorshDeserialize,
impl BorshDeserialize for AccountPositionwhere
Pubkey: BorshDeserialize,
Pubkey: BorshDeserialize,
Pubkey: BorshDeserialize,
[u8; 16]: BorshDeserialize,
u64: BorshDeserialize,
u64: BorshDeserialize,
PriceInfo: BorshDeserialize,
u32: BorshDeserialize,
i16: BorshDeserialize,
u16: BorshDeserialize,
u64: BorshDeserialize,
AdapterPositionFlags: BorshDeserialize,
[u8; 23]: BorshDeserialize,
sourcefn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
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. Read more
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
Deserialize this instance from a slice of bytes.
sourceimpl BorshSerialize for AccountPositionwhere
Pubkey: BorshSerialize,
Pubkey: BorshSerialize,
Pubkey: BorshSerialize,
[u8; 16]: BorshSerialize,
u64: BorshSerialize,
u64: BorshSerialize,
PriceInfo: BorshSerialize,
u32: BorshSerialize,
i16: BorshSerialize,
u16: BorshSerialize,
u64: BorshSerialize,
AdapterPositionFlags: BorshSerialize,
[u8; 23]: BorshSerialize,
impl BorshSerialize for AccountPositionwhere
Pubkey: BorshSerialize,
Pubkey: BorshSerialize,
Pubkey: BorshSerialize,
[u8; 16]: BorshSerialize,
u64: BorshSerialize,
u64: BorshSerialize,
PriceInfo: BorshSerialize,
u32: BorshSerialize,
i16: BorshSerialize,
u16: BorshSerialize,
u64: BorshSerialize,
AdapterPositionFlags: BorshSerialize,
[u8; 23]: BorshSerialize,
sourceimpl Clone for AccountPosition
impl Clone for AccountPosition
sourcefn clone(&self) -> AccountPosition
fn clone(&self) -> AccountPosition
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for AccountPosition
impl Debug for AccountPosition
sourceimpl Default for AccountPosition
impl Default for AccountPosition
sourcefn default() -> AccountPosition
fn default() -> AccountPosition
Returns the “default value” for a type. Read more
sourceimpl Zeroable for AccountPosition
impl Zeroable for AccountPosition
impl Copy for AccountPosition
impl Pod for AccountPosition
Auto Trait Implementations
impl RefUnwindSafe for AccountPosition
impl Send for AccountPosition
impl Sync for AccountPosition
impl Unpin for AccountPosition
impl UnwindSafe for AccountPosition
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
type Bits = T
type Bits = T
Self
must have the same layout as the specified Bits
except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern
. Read more