Skip to main content

BeginSettle

Struct BeginSettle 

Source
pub struct BeginSettle<'a> {
    pub program_id: Pubkey,
    pub state_pda: Pubkey,
    pub solver: Pubkey,
    pub finalize_ix_index: u16,
    pub auction_id: i64,
    pub only_token_program: Option<TokenProgram>,
    pub order_pdas: &'a [Pubkey],
    pub sell_token_accounts: &'a [Pubkey],
    pub sell_mints: &'a [Option<Pubkey>],
    pub pulls: &'a [&'a [Pull]],
}
Expand description

Builder for a BeginSettle instruction settling the orders described by the parallel lists:

  • order_pdas[i] is the canonical order PDA (see crate::pda::order)
  • sell_token_accounts[i] is the order’s sell token account,
  • sell_mints[i] is the order’s sell mint if its pulls use TransferChecked, or None for plain Transfer,
  • pulls[i] the list of Pulls to perform from that order’s sell token account, each sending an amount from the i-th order sell token account to a destination.

The slices are assumed to have the same length but this is not enforced in the builder.

Wire format (grouped, with n orders and T total transfers): [discriminator=0][finalize_ix_index: u16 LE][auction_id: i64 LE][n: u8] [transfer_count×n][amount: u64 LE ×T]. Required accounts: [solver (S,R), instructions_sysvar (R), state_pda (R), spl_token_program (R), token_2022_program (R)] followed, per order, by [order_pda (W), sell_token_account (W), sell_mint (R), destination (W)...]. The token program accounts are there to allow CPI calls against the corresponding token program, and are otherwise not parsed or validated, so it is possible to replace these accounts with the system program (or any other program) if they are unused. A sell_mint holding MINT_PLACEHOLDER makes the order’s pulls plain Transfers; any other mint makes them TransferChecked.

solver must sign, and the solver must be registered in the state pda.

The program requires the order PDAs to be strictly increasing by address. This builder establishes that ordering for the caller: it sorts the orders by PDA address, carrying each order’s sell token account, transfer count, amounts, and destination metas before emitting them.

Fields§

§program_id: Pubkey§state_pda: Pubkey§solver: Pubkey§finalize_ix_index: u16§auction_id: i64

The off-chain auction this settlement executes. Carried in the instruction data so the settlement can be tied back to its auction off-chain, unused on-chain.

§only_token_program: Option<TokenProgram>

The only token program this settlement’s transfers are issued against, or None to name every supported one; see TokenProgram::ALL.

§order_pdas: &'a [Pubkey]§sell_token_accounts: &'a [Pubkey]§sell_mints: &'a [Option<Pubkey>]§pulls: &'a [&'a [Pull]]

Trait Implementations§

Source§

impl From<BeginSettle<'_>> for Instruction

Source§

fn from(builder: BeginSettle<'_>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'a> Freeze for BeginSettle<'a>

§

impl<'a> RefUnwindSafe for BeginSettle<'a>

§

impl<'a> Send for BeginSettle<'a>

§

impl<'a> Sync for BeginSettle<'a>

§

impl<'a> Unpin for BeginSettle<'a>

§

impl<'a> UnsafeUnpin for BeginSettle<'a>

§

impl<'a> UnwindSafe for BeginSettle<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.