pub struct OrderAccount {
pub bump: u8,
pub cancelled: bool,
pub amount_withdrawn: u64,
pub amount_received: u64,
pub created_by: Pubkey,
pub intent: OrderIntent,
}Expand description
Idiomatic representation of an order PDA’s body.
Fields§
§bump: u8Canonical bump of the PDA this account lives at. Written at creation
time so callers don’t need to supply it; see Self::load_from_pda.
cancelled: boolfalse = the order is still active and can be filled; true = the
order has been cancelled by the owner and must not be filled.
amount_withdrawn: u64Cumulative amount of the sell token withdrawn for this order across settlements. Starts at zero; monotonically increases.
amount_received: u64Cumulative amount of the buy token received for this order across settlements. Starts at zero; monotonically increases.
created_by: PubkeyAccount that funded the rent for this PDA. The rent is refunded here when the order is cleared.
intent: OrderIntentThe order intent stored in this PDA.
Implementations§
Source§impl OrderAccount
impl OrderAccount
Sourcepub fn load_from_pda(
order_pda: &AccountView,
program_id: &Address,
) -> Result<Self, ProgramError>
pub fn load_from_pda( order_pda: &AccountView, program_id: &Address, ) -> Result<Self, ProgramError>
Load and decode the order at the given PDA, and confirm the PDA is derivable from its own data: both the UID and the bump feeding the derivation come from the stored body.
Sourcepub fn is_fully_filled(&self) -> bool
pub fn is_fully_filled(&self) -> bool
Whether the order has been filled to the full amount of its exact side, so no settlement can ever fill it again.
Trait Implementations§
Source§impl Clone for OrderAccount
impl Clone for OrderAccount
Source§fn clone(&self) -> OrderAccount
fn clone(&self) -> OrderAccount
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more