Struct mango_v4::state::Serum3Orders
source · #[repr(C)]pub struct Serum3Orders {Show 14 fields
pub open_orders: Pubkey,
pub base_borrows_without_fee: u64,
pub quote_borrows_without_fee: u64,
pub market_index: Serum3MarketIndex,
pub base_token_index: TokenIndex,
pub quote_token_index: TokenIndex,
pub padding: [u8; 2],
pub highest_placed_bid_inv: f64,
pub lowest_placed_ask: f64,
pub potential_base_tokens: u64,
pub potential_quote_tokens: u64,
pub lowest_placed_bid_inv: f64,
pub highest_placed_ask: f64,
pub reserved: [u8; 16],
}
Fields§
§open_orders: Pubkey
§base_borrows_without_fee: u64
Tracks the amount of borrows that have flowed into the serum open orders account. These borrows did not have the loan origination fee applied, and that may happen later (in serum3_settle_funds) if we can guarantee that the funds were used. In particular a place-on-book, cancel, settle should not cost fees.
quote_borrows_without_fee: u64
§market_index: Serum3MarketIndex
§base_token_index: TokenIndex
Store the base/quote token index, so health computations don’t need to get passed the static SerumMarket to find which tokens a market uses and look up the correct oracles.
quote_token_index: TokenIndex
§padding: [u8; 2]
§highest_placed_bid_inv: f64
Track something like the highest open bid / lowest open ask, in native/native units.
Tracking it exactly isn’t possible since we don’t see fills. So instead track the min/max of the placed bids and asks.
The value is reset in serum3_place_order when a new order is placed without an existing one on the book.
0 is a special “unset” state.
lowest_placed_ask: f64
§potential_base_tokens: u64
An overestimate of the amount of tokens that might flow out of the open orders account.
The bank still considers these amounts user deposits (see Bank::potential_serum_tokens) and that value needs to be updated in conjunction with these numbers.
This estimation is based on the amount of tokens in the open orders account (see update_bank_potential_tokens() in serum3_place_order and settle)
potential_quote_tokens: u64
§lowest_placed_bid_inv: f64
Track lowest bid/highest ask, same way as for highest bid/lowest ask.
0 is a special “unset” state.
highest_placed_ask: f64
§reserved: [u8; 16]
Implementations§
source§impl Serum3Orders
impl Serum3Orders
pub fn is_active(&self) -> bool
pub fn is_active_for_market(&self, market_index: Serum3MarketIndex) -> bool
Trait Implementations§
source§impl BorshDeserialize for Serum3Orderswhere
Pubkey: BorshDeserialize,
u64: BorshDeserialize,
Serum3MarketIndex: BorshDeserialize,
TokenIndex: BorshDeserialize,
[u8; 2]: BorshDeserialize,
f64: BorshDeserialize,
[u8; 16]: BorshDeserialize,
impl BorshDeserialize for Serum3Orderswhere Pubkey: BorshDeserialize, u64: BorshDeserialize, Serum3MarketIndex: BorshDeserialize, TokenIndex: BorshDeserialize, [u8; 2]: BorshDeserialize, f64: BorshDeserialize, [u8; 16]: BorshDeserialize,
fn deserialize_reader<R: Read>(reader: &mut R) -> Result<Self, Error>
§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where R: Read,
source§impl BorshSerialize for Serum3Orderswhere
Pubkey: BorshSerialize,
u64: BorshSerialize,
Serum3MarketIndex: BorshSerialize,
TokenIndex: BorshSerialize,
[u8; 2]: BorshSerialize,
f64: BorshSerialize,
[u8; 16]: BorshSerialize,
impl BorshSerialize for Serum3Orderswhere Pubkey: BorshSerialize, u64: BorshSerialize, Serum3MarketIndex: BorshSerialize, TokenIndex: BorshSerialize, [u8; 2]: BorshSerialize, f64: BorshSerialize, [u8; 16]: BorshSerialize,
source§impl Clone for Serum3Orders
impl Clone for Serum3Orders
source§fn clone(&self) -> Serum3Orders
fn clone(&self) -> Serum3Orders
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for Serum3Orders
impl Debug for Serum3Orders
source§impl Default for Serum3Orders
impl Default for Serum3Orders
source§impl PartialEq<Serum3Orders> for Serum3Orders
impl PartialEq<Serum3Orders> for Serum3Orders
source§fn eq(&self, other: &Serum3Orders) -> bool
fn eq(&self, other: &Serum3Orders) -> bool
self
and other
values to be equal, and is used
by ==
.impl Copy for Serum3Orders
impl Pod for Serum3Orders
impl StructuralPartialEq for Serum3Orders
Auto Trait Implementations§
impl RefUnwindSafe for Serum3Orders
impl Send for Serum3Orders
impl Sync for Serum3Orders
impl Unpin for Serum3Orders
impl UnwindSafe for Serum3Orders
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere T: 'a,
source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where T: CheckedCast<Dst>,
§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
.§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
bits
as &Self
.