use num_derive::FromPrimitive;
use thiserror::Error;
#[derive(Clone, Debug, Eq, Error, FromPrimitive, PartialEq)]
pub enum RaydiumAmmError {
#[error("AlreadyInUse")]
AlreadyInUse = 0x0,
#[error("InvalidProgramAddress")]
InvalidProgramAddress = 0x1,
#[error("ExpectedMint")]
ExpectedMint = 0x2,
#[error("ExpectedAccount")]
ExpectedAccount = 0x3,
#[error("InvalidCoinVault")]
InvalidCoinVault = 0x4,
#[error("InvalidPCVault")]
InvalidPCVault = 0x5,
#[error("InvalidTokenLP")]
InvalidTokenLP = 0x6,
#[error("InvalidDestTokenCoin")]
InvalidDestTokenCoin = 0x7,
#[error("InvalidDestTokenPC")]
InvalidDestTokenPC = 0x8,
#[error("InvalidPoolMint")]
InvalidPoolMint = 0x9,
#[error("InvalidOpenOrders")]
InvalidOpenOrders = 0xA,
#[error("InvalidSerumMarket")]
InvalidSerumMarket = 0xB,
#[error("InvalidSerumProgram")]
InvalidSerumProgram = 0xC,
#[error("InvalidTargetOrders")]
InvalidTargetOrders = 0xD,
#[error("InvalidWithdrawQueue")]
InvalidWithdrawQueue = 0xE,
#[error("InvalidTempLp")]
InvalidTempLp = 0xF,
#[error("InvalidCoinMint")]
InvalidCoinMint = 0x10,
#[error("InvalidPCMint")]
InvalidPCMint = 0x11,
#[error("InvalidOwner")]
InvalidOwner = 0x12,
#[error("InvalidSupply")]
InvalidSupply = 0x13,
#[error("InvalidDelegate")]
InvalidDelegate = 0x14,
#[error("Invalid Sign Account")]
InvalidSignAccount = 0x15,
#[error("InvalidStatus")]
InvalidStatus = 0x16,
#[error("Invalid instruction")]
InvalidInstruction = 0x17,
#[error("Wrong accounts number")]
WrongAccountsNumber = 0x18,
#[error("Withdraw_transfer is busy")]
WithdrawTransferBusy = 0x19,
#[error("WithdrawQueue is full")]
WithdrawQueueFull = 0x1A,
#[error("WithdrawQueue is empty")]
WithdrawQueueEmpty = 0x1B,
#[error("Params Set is invalid")]
InvalidParamsSet = 0x1C,
#[error("InvalidInput")]
InvalidInput = 0x1D,
#[error("instruction exceeds desired slippage limit")]
ExceededSlippage = 0x1E,
#[error("CalculationExRateFailure")]
CalculationExRateFailure = 0x1F,
#[error("Checked_Sub Overflow")]
CheckedSubOverflow = 0x20,
#[error("Checked_Add Overflow")]
CheckedAddOverflow = 0x21,
#[error("Checked_Mul Overflow")]
CheckedMulOverflow = 0x22,
#[error("Checked_Div Overflow")]
CheckedDivOverflow = 0x23,
#[error("Empty Funds")]
CheckedEmptyFunds = 0x24,
#[error("Calc pnl error")]
CalcPnlError = 0x25,
#[error("InvalidSplTokenProgram")]
InvalidSplTokenProgram = 0x26,
#[error("Take Pnl error")]
TakePnlError = 0x27,
#[error("Insufficient funds")]
InsufficientFunds = 0x28,
#[error("Conversion to u64 failed with an overflow or underflow")]
ConversionFailure = 0x29,
#[error("user token input does not match amm")]
InvalidUserToken = 0x2A,
#[error("InvalidSrmMint")]
InvalidSrmMint = 0x2B,
#[error("InvalidSrmToken")]
InvalidSrmToken = 0x2C,
#[error("TooManyOpenOrders")]
TooManyOpenOrders = 0x2D,
#[error("OrderAtSlotIsPlaced")]
OrderAtSlotIsPlaced = 0x2E,
#[error("InvalidSysProgramAddress")]
InvalidSysProgramAddress = 0x2F,
#[error("The provided fee does not match the program owner's constraints")]
InvalidFee = 0x30,
#[error("Repeat create amm about market")]
RepeatCreateAmm = 0x31,
#[error("Not allow Zero LP")]
NotAllowZeroLP = 0x32,
#[error("Token account has a close authority")]
InvalidCloseAuthority = 0x33,
#[error("Pool token mint has a freeze authority")]
InvalidFreezeAuthority = 0x34,
#[error("InvalidReferPCMint")]
InvalidReferPCMint = 0x35,
#[error("InvalidConfigAccount")]
InvalidConfigAccount = 0x36,
#[error("Repeat create staking config account")]
RepeatCreateConfigAccount = 0x37,
#[error("Unknown Amm Error")]
UnknownAmmError = 0x38,
}
#[allow(deprecated)]
impl solana_program_error::PrintProgramError for RaydiumAmmError {
fn print<E>(&self) {
solana_msg::msg!(&self.to_string());
}
}
#[allow(deprecated)]
impl<T> solana_decode_error::DecodeError<T> for RaydiumAmmError {
fn type_of() -> &'static str {
"RaydiumAmmError"
}
}