meteora-dbc-client 0.1.1

Rust SDK for Meteora Dynamic Bonding Curve 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 DynamicBondingCurveError {
    /// 6000 - Math operation overflow
    #[error("Math operation overflow")]
    MathOverflow = 0x1770,
    /// 6001 - Invalid fee setup
    #[error("Invalid fee setup")]
    InvalidFee = 0x1771,
    /// 6002 - Exceeded slippage tolerance
    #[error("Exceeded slippage tolerance")]
    ExceededSlippage = 0x1772,
    /// 6003 - Exceeded max fee bps
    #[error("Exceeded max fee bps")]
    ExceedMaxFeeBps = 0x1773,
    /// 6004 - Invalid admin
    #[error("Invalid admin")]
    InvalidAdmin = 0x1774,
    /// 6005 - Amount is zero
    #[error("Amount is zero")]
    AmountIsZero = 0x1775,
    /// 6006 - Type cast error
    #[error("Type cast error")]
    TypeCastFailed = 0x1776,
    /// 6007 - Invalid activation type
    #[error("Invalid activation type")]
    InvalidActivationType = 0x1777,
    /// 6008 - Invalid quote mint
    #[error("Invalid quote mint")]
    InvalidQuoteMint = 0x1778,
    /// 6009 - Invalid collect fee mode
    #[error("Invalid collect fee mode")]
    InvalidCollectFeeMode = 0x1779,
    /// 6010 - Invalid migration fee option
    #[error("Invalid migration fee option")]
    InvalidMigrationFeeOption = 0x177A,
    /// 6011 - Invalid input
    #[error("Invalid input")]
    InvalidInput = 0x177B,
    /// 6012 - Not enough liquidity
    #[error("Not enough liquidity")]
    NotEnoughLiquidity = 0x177C,
    /// 6013 - Pool is completed
    #[error("Pool is completed")]
    PoolIsCompleted = 0x177D,
    /// 6014 - Pool is incompleted
    #[error("Pool is incompleted")]
    PoolIsIncompleted = 0x177E,
    /// 6015 - Invalid migration option
    #[error("Invalid migration option")]
    InvalidMigrationOption = 0x177F,
    /// 6016 - Invalid activation type
    #[error("Invalid activation type")]
    InvalidTokenDecimals = 0x1780,
    /// 6017 - Invalid token type
    #[error("Invalid token type")]
    InvalidTokenType = 0x1781,
    /// 6018 - Invalid fee percentage
    #[error("Invalid fee percentage")]
    InvalidFeePercentage = 0x1782,
    /// 6019 - Invalid quote threshold
    #[error("Invalid quote threshold")]
    InvalidQuoteThreshold = 0x1783,
    /// 6020 - Invalid token supply
    #[error("Invalid token supply")]
    InvalidTokenSupply = 0x1784,
    /// 6021 - Invalid curve
    #[error("Invalid curve")]
    InvalidCurve = 0x1785,
    /// 6022 - Not permit to do this action
    #[error("Not permit to do this action")]
    NotPermitToDoThisAction = 0x1786,
    /// 6023 - Invalid owner account
    #[error("Invalid owner account")]
    InvalidOwnerAccount = 0x1787,
    /// 6024 - Invalid config account
    #[error("Invalid config account")]
    InvalidConfigAccount = 0x1788,
    /// 6025 - Surplus has been withdraw
    #[error("Surplus has been withdraw")]
    SurplusHasBeenWithdraw = 0x1789,
    /// 6026 - Leftover has been withdraw
    #[error("Leftover has been withdraw")]
    LeftoverHasBeenWithdraw = 0x178A,
    /// 6027 - Total base token is exceeded max supply
    #[error("Total base token is exceeded max supply")]
    TotalBaseTokenExceedMaxSupply = 0x178B,
    /// 6028 - Unsupport native mint token 2022
    #[error("Unsupport native mint token 2022")]
    UnsupportNativeMintToken2022 = 0x178C,
    /// 6029 - Insufficient liquidity for migration
    #[error("Insufficient liquidity for migration")]
    InsufficientLiquidityForMigration = 0x178D,
    /// 6030 - Missing pool config in remaining account
    #[error("Missing pool config in remaining account")]
    MissingPoolConfigInRemainingAccount = 0x178E,
    /// 6031 - Invalid vesting parameters
    #[error("Invalid vesting parameters")]
    InvalidVestingParameters = 0x178F,
    /// 6032 - Invalid leftover address
    #[error("Invalid leftover address")]
    InvalidLeftoverAddress = 0x1790,
    /// 6033 - Swap amount is over a threshold
    #[error("Swap amount is over a threshold")]
    SwapAmountIsOverAThreshold = 0x1791,
    /// 6034 - Invalid fee scheduler
    #[error("Invalid fee scheduler")]
    InvalidFeeScheduler = 0x1792,
    /// 6035 - Invalid creator trading fee percentage
    #[error("Invalid creator trading fee percentage")]
    InvalidCreatorTradingFeePercentage = 0x1793,
    /// 6036 - Invalid new creator
    #[error("Invalid new creator")]
    InvalidNewCreator = 0x1794,
    /// 6037 - Invalid token authority option
    #[error("Invalid token authority option")]
    InvalidTokenAuthorityOption = 0x1795,
    /// 6038 - Invalid account for the instruction
    #[error("Invalid account for the instruction")]
    InvalidAccount = 0x1796,
    /// 6039 - Invalid migrator fee percentage
    #[error("Invalid migrator fee percentage")]
    InvalidMigratorFeePercentage = 0x1797,
    /// 6040 - Migration fee has been withdraw
    #[error("Migration fee has been withdraw")]
    MigrationFeeHasBeenWithdraw = 0x1798,
    /// 6041 - Invalid base fee mode
    #[error("Invalid base fee mode")]
    InvalidBaseFeeMode = 0x1799,
    /// 6042 - Invalid fee rate limiter
    #[error("Invalid fee rate limiter")]
    InvalidFeeRateLimiter = 0x179A,
    /// 6043 - Fail to validate single swap instruction in rate limiter
    #[error("Fail to validate single swap instruction in rate limiter")]
    FailToValidateSingleSwapInstruction = 0x179B,
    /// 6044 - Invalid migrated pool fee params
    #[error("Invalid migrated pool fee params")]
    InvalidMigratedPoolFee = 0x179C,
    /// 6045 - Undertermined error
    #[error("Undertermined error")]
    UndeterminedError = 0x179D,
    /// 6046 - Rate limiter not supported
    #[error("Rate limiter not supported")]
    RateLimiterNotSupported = 0x179E,
    /// 6047 - Amount left is not zero
    #[error("Amount left is not zero")]
    AmountLeftIsNotZero = 0x179F,
    /// 6048 - Next sqrt price is smaller than start sqrt price
    #[error("Next sqrt price is smaller than start sqrt price")]
    NextSqrtPriceIsSmallerThanStartSqrtPrice = 0x17A0,
    /// 6049 - Invalid min base fee
    #[error("Invalid min base fee")]
    InvalidMinBaseFee = 0x17A1,
    /// 6050 - Account invariant violation
    #[error("Account invariant violation")]
    AccountInvariantViolation = 0x17A2,
}

impl From<DynamicBondingCurveError> for solana_program_error::ProgramError {
    fn from(e: DynamicBondingCurveError) -> Self {
        solana_program_error::ProgramError::Custom(e as u32)
    }
}