Skip to main content

Offer

The Offer struct represents a single order on the orderbook.

Offer Structure

#[repr(C)]
pub struct Offer {
    /// Order size in SY, PT, or YT (deposited amount)
    pub amount: u64,

    /// Expiry time as Unix timestamp
    pub expiry_at: u32,

    /// Created at Unix timestamp
    pub created_at: u32,

    /// Virtual offer flag (true if this is a PT order)
    pub virtual_offer: u8,

    /// Offer type flag (SellYt or BuyYt)
    pub offer_type_flag: u8,

    /// Fill or kill flag
    /// If true, the order must be filled completely or cancelled
    pub fill_or_kill: u8,

    /// Reserved padding for alignment
    pub _reserved: [u8; 5],
}

Fields

FieldTypeDescription
amountu64Order size in lamports
expiry_atu32Unix timestamp when the offer expires
created_atu32Unix timestamp when the offer was created
virtual_offeru81 if this is a virtual (PT) order, 0 otherwise
offer_type_flagu8Offer type (SellYt or BuyYt)
fill_or_killu81 if order must fill completely or cancel

OfferType

#[repr(u8)]
pub enum OfferType {
    SellYt = 1,
    BuyYt = 2,
}
VariantValueDescription
SellYt1Selling YT for SY
BuyYt2Buying YT with SY

Virtual Offers

When virtual_offer is set to 1, the offer represents a PT order rather than a direct YT order. The orderbook converts between PT and YT using strip/merge at the taker level.
  • virtual_offer = 0: Direct YT order
  • virtual_offer = 1: Virtual PT order (converted via strip/merge)