meteora-pools-sdk 0.1.1

Rust SDK for Meteora Pools program
Documentation
//! This code was AUTOGENERATED using the codama library.
//! Please DO NOT EDIT THIS FILE, instead use visitors
//! to add features, then rerun codama to update it.
//!
//! <https://github.com/codama-idl/codama>
//!

use num_derive::FromPrimitive;
use thiserror::Error;

#[derive(Clone, Debug, Eq, Error, FromPrimitive, PartialEq)]
pub enum AmmError {
    /// 6000 - Math operation overflow
    #[error("Math operation overflow")]
    MathOverflow = 0x1770,
    /// 6001 - Invalid fee setup
    #[error("Invalid fee setup")]
    InvalidFee = 0x1771,
    /// 6002 - Invalid invariant d
    #[error("Invalid invariant d")]
    InvalidInvariant = 0x1772,
    /// 6003 - Fee calculation failure
    #[error("Fee calculation failure")]
    FeeCalculationFailure = 0x1773,
    /// 6004 - Exceeded slippage tolerance
    #[error("Exceeded slippage tolerance")]
    ExceededSlippage = 0x1774,
    /// 6005 - Invalid curve calculation
    #[error("Invalid curve calculation")]
    InvalidCalculation = 0x1775,
    /// 6006 - Given pool token amount results in zero trading tokens
    #[error("Given pool token amount results in zero trading tokens")]
    ZeroTradingTokens = 0x1776,
    /// 6007 - Math conversion overflow
    #[error("Math conversion overflow")]
    ConversionError = 0x1777,
    /// 6008 - LP mint authority must be 'A' vault lp, without freeze authority, and 0 supply
    #[error("LP mint authority must be 'A' vault lp, without freeze authority, and 0 supply")]
    FaultyLpMint = 0x1778,
    /// 6009 - Token mint mismatched
    #[error("Token mint mismatched")]
    MismatchedTokenMint = 0x1779,
    /// 6010 - LP mint mismatched
    #[error("LP mint mismatched")]
    MismatchedLpMint = 0x177A,
    /// 6011 - Invalid lp token owner
    #[error("Invalid lp token owner")]
    MismatchedOwner = 0x177B,
    /// 6012 - Invalid vault account
    #[error("Invalid vault account")]
    InvalidVaultAccount = 0x177C,
    /// 6013 - Invalid vault lp account
    #[error("Invalid vault lp account")]
    InvalidVaultLpAccount = 0x177D,
    /// 6014 - Invalid pool lp mint account
    #[error("Invalid pool lp mint account")]
    InvalidPoolLpMintAccount = 0x177E,
    /// 6015 - Pool disabled
    #[error("Pool disabled")]
    PoolDisabled = 0x177F,
    /// 6016 - Invalid admin account
    #[error("Invalid admin account")]
    InvalidAdminAccount = 0x1780,
    /// 6017 - Invalid protocol fee account
    #[error("Invalid protocol fee account")]
    InvalidProtocolFeeAccount = 0x1781,
    /// 6018 - Same admin account
    #[error("Same admin account")]
    SameAdminAccount = 0x1782,
    /// 6019 - Identical user source and destination token account
    #[error("Identical user source and destination token account")]
    IdenticalSourceDestination = 0x1783,
    /// 6020 - Apy calculation error
    #[error("Apy calculation error")]
    ApyCalculationError = 0x1784,
    /// 6021 - Insufficient virtual price snapshot
    #[error("Insufficient virtual price snapshot")]
    InsufficientSnapshot = 0x1785,
    /// 6022 - Current curve is non-updatable
    #[error("Current curve is non-updatable")]
    NonUpdatableCurve = 0x1786,
    /// 6023 - New curve is mismatched with old curve
    #[error("New curve is mismatched with old curve")]
    MisMatchedCurve = 0x1787,
    /// 6024 - Amplification is invalid
    #[error("Amplification is invalid")]
    InvalidAmplification = 0x1788,
    /// 6025 - Operation is not supported
    #[error("Operation is not supported")]
    UnsupportedOperation = 0x1789,
    /// 6026 - Exceed max amplification changes
    #[error("Exceed max amplification changes")]
    ExceedMaxAChanges = 0x178A,
    /// 6027 - Invalid remaining accounts length
    #[error("Invalid remaining accounts length")]
    InvalidRemainingAccountsLen = 0x178B,
    /// 6028 - Invalid remaining account
    #[error("Invalid remaining account")]
    InvalidRemainingAccounts = 0x178C,
    /// 6029 - Token mint B doesn't matches depeg type token mint
    #[error("Token mint B doesn't matches depeg type token mint")]
    MismatchedDepegMint = 0x178D,
    /// 6030 - Invalid APY account
    #[error("Invalid APY account")]
    InvalidApyAccount = 0x178E,
    /// 6031 - Invalid token multiplier
    #[error("Invalid token multiplier")]
    InvalidTokenMultiplier = 0x178F,
    /// 6032 - Invalid depeg information
    #[error("Invalid depeg information")]
    InvalidDepegInformation = 0x1790,
    /// 6033 - Update time constraint violated
    #[error("Update time constraint violated")]
    UpdateTimeConstraint = 0x1791,
    /// 6034 - Exceeded max fee bps
    #[error("Exceeded max fee bps")]
    ExceedMaxFeeBps = 0x1792,
    /// 6035 - Invalid admin
    #[error("Invalid admin")]
    InvalidAdmin = 0x1793,
    /// 6036 - Pool is not permissioned
    #[error("Pool is not permissioned")]
    PoolIsNotPermissioned = 0x1794,
    /// 6037 - Invalid deposit amount
    #[error("Invalid deposit amount")]
    InvalidDepositAmount = 0x1795,
    /// 6038 - Invalid fee owner
    #[error("Invalid fee owner")]
    InvalidFeeOwner = 0x1796,
    /// 6039 - Pool is not depleted
    #[error("Pool is not depleted")]
    NonDepletedPool = 0x1797,
    /// 6040 - Token amount is not 1:1
    #[error("Token amount is not 1:1")]
    AmountNotPeg = 0x1798,
    /// 6041 - Amount is zero
    #[error("Amount is zero")]
    AmountIsZero = 0x1799,
    /// 6042 - Type cast error
    #[error("Type cast error")]
    TypeCastFailed = 0x179A,
    /// 6043 - Amount is not enough
    #[error("Amount is not enough")]
    AmountIsNotEnough = 0x179B,
    /// 6044 - Invalid activation duration
    #[error("Invalid activation duration")]
    InvalidActivationDuration = 0x179C,
    /// 6045 - Pool is not launch pool
    #[error("Pool is not launch pool")]
    PoolIsNotLaunchPool = 0x179D,
    /// 6046 - Unable to modify activation point
    #[error("Unable to modify activation point")]
    UnableToModifyActivationPoint = 0x179E,
    /// 6047 - Invalid authority to create the pool
    #[error("Invalid authority to create the pool")]
    InvalidAuthorityToCreateThePool = 0x179F,
    /// 6048 - Invalid activation type
    #[error("Invalid activation type")]
    InvalidActivationType = 0x17A0,
    /// 6049 - Invalid activation point
    #[error("Invalid activation point")]
    InvalidActivationPoint = 0x17A1,
    /// 6050 - Pre activation swap window started
    #[error("Pre activation swap window started")]
    PreActivationSwapStarted = 0x17A2,
    /// 6051 - Invalid pool type
    #[error("Invalid pool type")]
    InvalidPoolType = 0x17A3,
    /// 6052 - Quote token must be SOL,USDC
    #[error("Quote token must be SOL,USDC")]
    InvalidQuoteMint = 0x17A4,
}

impl solana_program::program_error::PrintProgramError for AmmError {
    fn print<E>(&self) {
        solana_program::msg!(&self.to_string());
    }
}

impl<T> solana_program::decode_error::DecodeError<T> for AmmError {
    fn type_of() -> &'static str {
        "AmmError"
    }
}