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    #[deprecated(since = "0.1.4", note = "Fee no longer supported")]
23    pub fee: u64,
24
25    /// The collector of the fee.
26    #[deprecated(since = "0.1.4", note = "Fee no longer supported")]
27    pub fee_collector: Pubkey,
28
29    /// A unique identifier for the order, namespaced by the authority.
30    pub id: u64,
31
32    /// The mint of token A.
33    pub mint_a: Pubkey,
34
35    /// The mint of token B.
36    pub mint_b: Pubkey,
37
38    /// The total amount of token B deposited by takers.
39    pub total_deposits: u64,
40
41    /// The total number receipts issued for this order.
42    pub total_receipts: u64,
43
44    /// The total amount of receipts redeemed by takers.
45    pub total_redeemed: u64,
46
47    /// Is collected.
48    pub is_collected: u64,
49}
50
51account!(ProtobookAccount, Order);