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 (seecrate::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 useTransferChecked, orNonefor plainTransfer,pulls[i]the list ofPulls to perform from that order’s sell token account, each sending an amount from thei-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: i64The 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]]