Skip to main content

Module buffer

Module buffer 

Source
Expand description

Buffer PDA seed and address derivation.

Each buffer is a per-token SPL token account that holds funds controlled by the settlement state PDA. It lives at a PDA keyed by the token mint, so there is exactly one buffer address per token.

The token account stored at this address is initialized by the CreateBuffer instruction; its SPL owner (token authority) is the settlement state PDA (see crate::pda::state), the single authority controlling every buffer.

The seeds start with SETTLEMENT_SEED, which carries the cargo package major and minor version, so a version bump moves every buffer. Since only the state PDA can spend a buffer and that address moves too, buffers must be drained under the old version before a bump ships, or their contents are stranded.

Native SOL has a buffer of its own (see find_native_sol_buffer_pda): an empty account owned by the settlement program, whose lamports on top of rent pay out orders buying native SOL. It isn’t keyed by a mint, so its seeds follow a pattern of their own.

Unlike the order PDA, which stores its own bump (see crate::data::order::OrderAccount), a buffer’s layout belongs entirely to the token program, leaving no room for one.

Constants§

BUFFER_SEED
Trailing seed identifying the buffer PDAs.
KNOWN_MINTS
The 63 most-traded mints over the 12 full months to September 2026, filtered for staying power (traded in every month). Generated from https://dune.com/queries/8905140 Sorted by address for easier diffing
NATIVE_SOL_BUFFER_PDA_SEEDS
Canonical seed components for the native SOL buffer PDA.
NATIVE_SOL_BUFFER_SEED
Trailing seed identifying the native SOL buffer PDA.

Functions§

buffer_pda_seeds
Canonical seed components for the buffer PDA holding the specified mint token.
buffer_pda_signer_seeds
Canonical seeds for re-deriving the buffer PDA for mint with bump.
find_buffer_pda
Derive the canonical buffer PDA address (and bump) for the token mint.
find_native_sol_buffer_pda
Derive the canonical native SOL buffer PDA address (and bump).