protobook_api/state/
order.rs

1use steel::*;
2
3use super::ProtobookAccount;
4
5/// An order is a public, timebound offer to buy a given token at a fixed price.
6#[repr(C)]
7#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
8pub struct Order {
9    /// The maker of the order.
10    pub authority: Pubkey,
11
12    /// The amount of token A offered by the authority and locked in escrow.
13    pub amount_a: u64,
14
15    /// The amount of token B requested by the authority.
16    pub amount_b: u64,
17
18    /// The time at which the order expires.
19    pub expires_at: i64,
20
21    /// An optional fee to be paid by the authority if the order is filled.
22    pub fee: u64,
23
24    /// The collector of the fee.
25    pub fee_collector: Pubkey,
26
27    /// A unique identifier for the order, namespaced by the authority.
28    pub id: u64,
29
30    /// The mint of token A.
31    pub mint_a: Pubkey,
32
33    /// The mint of token B.
34    pub mint_b: Pubkey,
35
36    /// The total amount of token B deposited by takers.
37    pub total_deposits: u64,
38
39    /// The total number receipts issued for this order.
40    pub total_receipts: u64,
41
42    /// The total amount of receipts redeemed by takers.
43    pub total_redeemed: u64,
44
45    /// Is collected.
46    pub is_collected: u64,
47}
48
49account!(ProtobookAccount, Order);