Enum stable_swap::error::SwapError
source · [−]pub enum SwapError {
Show 29 variants
AlreadyInUse,
InvalidAdmin,
InvalidOwner,
InvalidOutputOwner,
InvalidProgramAddress,
ExpectedMint,
ExpectedAccount,
EmptyPool,
EmptySupply,
InvalidSupply,
InvalidDelegate,
InvalidInput,
IncorrectSwapAccount,
IncorrectMint,
CalculationFailure,
InvalidInstruction,
RepeatedMint,
ExceededSlippage,
InvalidCloseAuthority,
InvalidFreezeAuthority,
ConversionFailure,
Unauthorized,
IsPaused,
RampLocked,
InsufficientRampTime,
ActiveTransfer,
NoActiveTransfer,
AdminDeadlineExceeded,
MismatchedDecimals,
}
Expand description
Errors that may be returned by the StableSwap program.
Variants
AlreadyInUse
The account cannot be initialized because it is already being used.
InvalidAdmin
The address of the admin fee account is incorrect.
InvalidOwner
The owner of the input isn’t set to the program address generated by the program.
InvalidOutputOwner
The owner of the pool token output is set to the program address generated by the program.
InvalidProgramAddress
The program address provided doesn’t match the value generated by the program.
ExpectedMint
The deserialization of the account returned something besides State::Mint.
ExpectedAccount
The deserialization of the account returned something besides State::Account.
EmptyPool
The pool supply is empty.
EmptySupply
The input token account is empty.
InvalidSupply
The pool token mint has a non-zero supply.
InvalidDelegate
The provided token account has a delegate.
InvalidInput
The input token is invalid for swap.
IncorrectSwapAccount
Address of the provided swap token account is incorrect.
IncorrectMint
Address of the provided token mint is incorrect
CalculationFailure
The calculation failed.
InvalidInstruction
Invalid instruction number passed in.
RepeatedMint
Swap input token accounts have the same mint
ExceededSlippage
Swap instruction exceeds desired slippage limit
InvalidCloseAuthority
The provided token account has a close authority.
InvalidFreezeAuthority
The pool token mint has a freeze authority.
ConversionFailure
ConversionFailure
Unauthorized
Unauthorized
IsPaused
Swap pool is paused
RampLocked
Amp. coefficient change is within min ramp duration
InsufficientRampTime
Insufficient ramp time for the ramp operation
ActiveTransfer
Active admin transfer in progress
NoActiveTransfer
No active admin transfer in progress
AdminDeadlineExceeded
Admin transfer deadline exceeded
MismatchedDecimals
Token mint decimals must be the same.
Trait Implementations
sourceimpl<T> DecodeError<T> for SwapError
impl<T> DecodeError<T> for SwapError
pub fn type_of() -> &'static str
fn decode_custom_error_to_enum(custom: u32) -> Option<E> where
E: FromPrimitive,
sourceimpl Error for SwapError
impl Error for SwapError
1.30.0 · sourcefn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
sourcefn backtrace(&self) -> Option<&Backtrace>
fn backtrace(&self) -> Option<&Backtrace>
backtrace
)Returns a stack backtrace, if available, of where this error occurred. Read more
1.0.0 · sourcefn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
sourceimpl FromPrimitive for SwapError
impl FromPrimitive for SwapError
sourcepub fn from_i64(n: i64) -> Option<SwapError>
pub fn from_i64(n: i64) -> Option<SwapError>
Converts an i64
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
sourcepub fn from_u64(n: u64) -> Option<SwapError>
pub fn from_u64(n: u64) -> Option<SwapError>
Converts an u64
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
sourcefn from_isize(n: isize) -> Option<Self>
fn from_isize(n: isize) -> Option<Self>
Converts an isize
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
sourcefn from_i8(n: i8) -> Option<Self>
fn from_i8(n: i8) -> Option<Self>
Converts an i8
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
sourcefn from_i16(n: i16) -> Option<Self>
fn from_i16(n: i16) -> Option<Self>
Converts an i16
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
sourcefn from_i32(n: i32) -> Option<Self>
fn from_i32(n: i32) -> Option<Self>
Converts an i32
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
sourcefn from_i128(n: i128) -> Option<Self>
fn from_i128(n: i128) -> Option<Self>
Converts an i128
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
sourcefn from_usize(n: usize) -> Option<Self>
fn from_usize(n: usize) -> Option<Self>
Converts a usize
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
sourcefn from_u8(n: u8) -> Option<Self>
fn from_u8(n: u8) -> Option<Self>
Converts an u8
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
sourcefn from_u16(n: u16) -> Option<Self>
fn from_u16(n: u16) -> Option<Self>
Converts an u16
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
sourcefn from_u32(n: u32) -> Option<Self>
fn from_u32(n: u32) -> Option<Self>
Converts an u32
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
sourcefn from_u128(n: u128) -> Option<Self>
fn from_u128(n: u128) -> Option<Self>
Converts an u128
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
sourceimpl PrintProgramError for SwapError
impl PrintProgramError for SwapError
pub fn print<E>(&self) where
E: 'static + Error + DecodeError<E> + PrintProgramError + FromPrimitive,
impl Copy for SwapError
impl Eq for SwapError
impl StructuralEq for SwapError
impl StructuralPartialEq for SwapError
Auto Trait Implementations
impl RefUnwindSafe for SwapError
impl Send for SwapError
impl Sync for SwapError
impl Unpin for SwapError
impl UnwindSafe for SwapError
Blanket Implementations
impl<T> AbiExample for T
impl<T> AbiExample for T
pub default fn example() -> T
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more