Skip to main content

SettlementError

Enum SettlementError 

Source
#[repr(u32)]
pub enum SettlementError {
Show 49 variants FinalizeBeforeInitialize = 0, BeginFinalizePairOverlap = 1, MissingCounterpartInstruction = 2, CounterpartIsExternal = 3, InvalidCounterpartDiscriminator = 4, InvalidCounterpartCounterpart = 5, MismatchedCounterpartDiscriminator = 6, OwnerMismatch = 7, AccountNotDerivable = 8, OrdersNotStrictlyIncreasing = 9, SellTokenAccountMismatch = 10, SellTokenAccountInvalid = 11, SellTokenOwnerMismatch = 12, AccountCountNotMatchingOrderCount = 13, CalledViaCpi = 14, OrderCancelled = 15, OrderExpired = 16, TransferCountMismatch = 17, StateAccountMismatch = 18, AccountCountNotMatchingPushCount = 19, SettledOrderPushCountMismatch = 20, PushDestinationMismatch = 21, PushSourceNotBuffer = 22, SellMintMismatch = 23, LimitPriceViolated = 24, PullAmountOverflow = 25, FillExceedsOrderAmount = 26, OrderNotExactlyFilled = 27, AmountWithdrawnOverflow = 28, AmountReceivedOverflow = 29, OrderNotReclaimable = 30, ReclaimRecipientMismatch = 31, ReclaimAuthorityMismatch = 32, ReclaimBufferNotCanonical = 33, UnauthorizedAuthorityTransfer = 34, UnauthorizedSolverManagement = 35, SolverAlreadyExists = 36, UnauthorizedSolver = 37, SolverNotFound = 38, BufferSizeUnavailable = 39, InvalidTokenProgram = 40, UnauthorizedSettlementOwnedOrder = 41, ZeroOrderAmount = 42, InvalidMint = 43, PushSourceIsDestination = 44, NativeSolBufferEmptied = 45, ReclaimBufferBurnLimitExceeded = 46, UnauthorizedNativeSolWithdrawal = 47, NativeSolBufferMismatch = 48,
}
Expand description

Program-side errors surfaced by the settlement program. The discriminant value is the on-chain ProgramError::Custom code.

Variants§

§

FinalizeBeforeInitialize = 0

The FinalizeSettle included as input to BeginSettle isn’t before the actual BeginSettle index.

§

BeginFinalizePairOverlap = 1

Another BeginSettle/FinalizeSettle of this program appears strictly between this pair’s bounds, nesting or overlapping two settlements.

§

MissingCounterpartInstruction = 2

The counterpart index points past the end of the transaction’s instruction list, so no instruction sits there.

§

CounterpartIsExternal = 3

The instruction at the counterpart index belongs to a different program.

§

InvalidCounterpartDiscriminator = 4

The counterpart instruction’s discriminator byte couldn’t be recovered from its data.

§

InvalidCounterpartCounterpart = 5

The counterpart instruction’s own counterpart index couldn’t be recovered from its data.

§

MismatchedCounterpartDiscriminator = 6

The counterpart’s discriminator isn’t the expected BeginSettle/FinalizeSettle kind, or its counterpart index doesn’t point back at this instruction.

§

OwnerMismatch = 7

An order-creation instruction’s intent owner isn’t the owner it must have: the signer for CreateOrder, the settlement state PDA for CreateSettlementOwnedOrder.

§

AccountNotDerivable = 8

An account was provided that cannot be derived from the seeds recognized by the program

§

OrdersNotStrictlyIncreasing = 9

BeginSettle’s order accounts aren’t passed strictly increasing by address.

§

SellTokenAccountMismatch = 10

A BeginSettle sell token account doesn’t match the sell_token_account recorded in the order’s intent.

§

SellTokenAccountInvalid = 11

A BeginSettle sell token account isn’t a valid SPL token account (wrong data length or not owned by the token program).

§

SellTokenOwnerMismatch = 12

A BeginSettle sell token account’s SPL owner isn’t the order’s intent owner.

§

AccountCountNotMatchingOrderCount = 13

BeginSettle’s order-account count doesn’t match the structure its instruction data expects: n orders each contribute an order PDA, a sell token account, a sell mint, plus one destination account per transfer.

§

CalledViaCpi = 14

BeginSettle or FinalizeSettle was invoked via CPI rather than as a top-level transaction instruction.

§

OrderCancelled = 15

A BeginSettle order has been cancelled by its owner and can no longer be settled.

§

OrderExpired = 16

A BeginSettle order’s valid_to lies in the past: the order has expired and can no longer be settled.

§

TransferCountMismatch = 17

The transfer counts in BeginSettle don’t sum to the number of transfer amounts, so destinations and amounts can’t be paired up exactly.

§

StateAccountMismatch = 18

BeginSettle’s state account isn’t the canonical settlement state PDA, which must sign the pulls as the user’s token delegate.

§

AccountCountNotMatchingPushCount = 19

FinalizeSettle’s push-account count doesn’t match its instruction data: each push contributes a source buffer, a destination, and a mint, so the count must be three times the number of push amounts.

§

SettledOrderPushCountMismatch = 20

BeginSettle: the number of pushes carried by the paired FinalizeSettle doesn’t equal the number of settled orders. Each order must be paid by exactly one push.

§

PushDestinationMismatch = 21

BeginSettle: a paired FinalizeSettle push doesn’t send its proceeds to the order’s buy token account; its destination differs from the buy_token_account in the order’s intent.

§

PushSourceNotBuffer = 22

BeginSettle: a paired FinalizeSettle push doesn’t draw funds from the canonical buffer for the order’s buy_mint.

§

SellMintMismatch = 23

BeginSettle: the OrderIntent sell_token_account holds a different mint than the declared sell_mint.

§

LimitPriceViolated = 24

BeginSettle: a settled order’s executed price (amount_out/amount_in) is worse than the order’s limit price (buy_amount/sell_amount).

§

PullAmountOverflow = 25

BeginSettle: an order’s pull amounts sum to more than u64::MAX.

§

FillExceedsOrderAmount = 26

BeginSettle: filling this order would consume more tokens than the maximum the user is willing to trade on this intent. Sell: amount_in > sell_amount; buy: amount_out > buy_amount.

§

OrderNotExactlyFilled = 27

BeginSettle: a non-partially_fillable order isn’t filled exactly to its amount (either under- or over-filled). Sell: amount_in != sell_amount; buy: total amount_out != buy_amount.

§

AmountWithdrawnOverflow = 28

BeginSettle: the order’s cumulative amount_withdrawn would exceed u64::MAX once this settlement’s pulls are added.

§

AmountReceivedOverflow = 29

BeginSettle: the order’s cumulative amount_received would exceed u64::MAX once this settlement’s push is added.

§

OrderNotReclaimable = 30

ReclaimOrder was called on an order that has not yet become eligible for reclaim.

§

ReclaimRecipientMismatch = 31

ReclaimOrder’s reclaim_recipient account doesn’t match the created_by address recorded in the order.

§

ReclaimAuthorityMismatch = 32

ReclaimBuffer’s reclaim_authority account isn’t a signer, or doesn’t match the reclaim_authority address recorded in the settlement state PDA.

§

ReclaimBufferNotCanonical = 33

A ReclaimBuffer buffer_pda doesn’t sit at the canonical buffer PDA derived from its paired mint.

§

UnauthorizedAuthorityTransfer = 34

TransferAuthority’s signer is neither the manager nor the current holder of the role being transferred, so it may not transfer it.

§

UnauthorizedSolverManagement = 35

AddSolver/RemoveSolver’s solver-authority account isn’t a signer, or doesn’t match the solver_authority recorded in the settlement state PDA, so it may not change the solver list.

§

SolverAlreadyExists = 36

AddSolver’s solver is already in the state PDA’s solver list.

§

UnauthorizedSolver = 37

BeginSettle’s solver account isn’t a signer or isn’t in the state PDA’s solver list, so it may not settle.

§

SolverNotFound = 38

RemoveSolver’s solver isn’t in the state PDA’s solver list.

§

BufferSizeUnavailable = 39

CreateBuffer asked the token program how long a token account for a mint has to be and couldn’t read the answer, so it can’t size the buffer.

§

InvalidTokenProgram = 40

The token program for a given token or mint is not supported.

§

UnauthorizedSettlementOwnedOrder = 41

CreateSettlementOwnedOrder’s settlement-owned-order-authority account isn’t a signer, or doesn’t match the settlement_owned_order_authority recorded in the settlement state PDA.

§

ZeroOrderAmount = 42

An intent has a zero sell or buy amount, which is not supported.

§

InvalidMint = 43

A mint account supplied to BeginSettle or FinalizeSettle was not able to be parsed as such.

§

PushSourceIsDestination = 44

BeginSettle: a paired FinalizeSettle push’s destination is the very buffer the push draws from, so settling it would move no funds yet still record the declared amount as received.

§

NativeSolBufferEmptied = 45

Moving lamports out of the native SOL buffer would empty it, which the runtime would then delete.

§

ReclaimBufferBurnLimitExceeded = 46

A buffer to be reclaimed holds more tokens than the burn limit supplied for it, so its balance can’t be cleared for closing.

§

UnauthorizedNativeSolWithdrawal = 47

WithdrawNativeSol’s authority account isn’t a signer, or doesn’t match the settlement_owned_order_authority recorded in the settlement state PDA.

§

NativeSolBufferMismatch = 48

WithdrawNativeSol’s native SOL buffer account isn’t the canonical native SOL buffer PDA.

Trait Implementations§

Source§

impl Clone for SettlementError

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for SettlementError

Source§

impl Debug for SettlementError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for SettlementError

Source§

impl From<SettlementError> for u32

Source§

fn from(e: SettlementError) -> Self

Converts to this type from the input type.
Source§

impl From<SettlementError> for ProgramError

Source§

fn from(e: SettlementError) -> Self

Converts to this type from the input type.
Source§

impl From<SettlementError> for InstructionError

Source§

fn from(e: SettlementError) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for SettlementError

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for SettlementError

Source§

impl TryFrom<u32> for SettlementError

Source§

type Error = TryFromPrimitiveError<SettlementError>

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

fn try_from(number: u32) -> Result<Self, TryFromPrimitiveError<Self>>

Performs the conversion.
Source§

impl TryFromPrimitive for SettlementError

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.