use num_derive::FromPrimitive;
use thiserror::Error;
#[derive(Clone, Debug, Eq, Error, FromPrimitive, PartialEq)]
pub enum DynamicBondingCurveError {
#[error("Math operation overflow")]
MathOverflow = 0x1770,
#[error("Invalid fee setup")]
InvalidFee = 0x1771,
#[error("Exceeded slippage tolerance")]
ExceededSlippage = 0x1772,
#[error("Exceeded max fee bps")]
ExceedMaxFeeBps = 0x1773,
#[error("Invalid admin")]
InvalidAdmin = 0x1774,
#[error("Amount is zero")]
AmountIsZero = 0x1775,
#[error("Type cast error")]
TypeCastFailed = 0x1776,
#[error("Invalid activation type")]
InvalidActivationType = 0x1777,
#[error("Invalid quote mint")]
InvalidQuoteMint = 0x1778,
#[error("Invalid collect fee mode")]
InvalidCollectFeeMode = 0x1779,
#[error("Invalid migration fee option")]
InvalidMigrationFeeOption = 0x177A,
#[error("Invalid input")]
InvalidInput = 0x177B,
#[error("Not enough liquidity")]
NotEnoughLiquidity = 0x177C,
#[error("Pool is completed")]
PoolIsCompleted = 0x177D,
#[error("Pool is incompleted")]
PoolIsIncompleted = 0x177E,
#[error("Invalid migration option")]
InvalidMigrationOption = 0x177F,
#[error("Invalid activation type")]
InvalidTokenDecimals = 0x1780,
#[error("Invalid token type")]
InvalidTokenType = 0x1781,
#[error("Invalid fee percentage")]
InvalidFeePercentage = 0x1782,
#[error("Invalid quote threshold")]
InvalidQuoteThreshold = 0x1783,
#[error("Invalid token supply")]
InvalidTokenSupply = 0x1784,
#[error("Invalid curve")]
InvalidCurve = 0x1785,
#[error("Not permit to do this action")]
NotPermitToDoThisAction = 0x1786,
#[error("Invalid owner account")]
InvalidOwnerAccount = 0x1787,
#[error("Invalid config account")]
InvalidConfigAccount = 0x1788,
#[error("Surplus has been withdraw")]
SurplusHasBeenWithdraw = 0x1789,
#[error("Leftover has been withdraw")]
LeftoverHasBeenWithdraw = 0x178A,
#[error("Total base token is exceeded max supply")]
TotalBaseTokenExceedMaxSupply = 0x178B,
#[error("Unsupport native mint token 2022")]
UnsupportNativeMintToken2022 = 0x178C,
#[error("Insufficient liquidity for migration")]
InsufficientLiquidityForMigration = 0x178D,
#[error("Missing pool config in remaining account")]
MissingPoolConfigInRemainingAccount = 0x178E,
#[error("Invalid vesting parameters")]
InvalidVestingParameters = 0x178F,
#[error("Invalid leftover address")]
InvalidLeftoverAddress = 0x1790,
#[error("Swap amount is over a threshold")]
SwapAmountIsOverAThreshold = 0x1791,
#[error("Invalid fee scheduler")]
InvalidFeeScheduler = 0x1792,
#[error("Invalid creator trading fee percentage")]
InvalidCreatorTradingFeePercentage = 0x1793,
#[error("Invalid new creator")]
InvalidNewCreator = 0x1794,
#[error("Invalid token authority option")]
InvalidTokenAuthorityOption = 0x1795,
#[error("Invalid account for the instruction")]
InvalidAccount = 0x1796,
#[error("Invalid migrator fee percentage")]
InvalidMigratorFeePercentage = 0x1797,
#[error("Migration fee has been withdraw")]
MigrationFeeHasBeenWithdraw = 0x1798,
#[error("Invalid base fee mode")]
InvalidBaseFeeMode = 0x1799,
#[error("Invalid fee rate limiter")]
InvalidFeeRateLimiter = 0x179A,
#[error("Fail to validate single swap instruction in rate limiter")]
FailToValidateSingleSwapInstruction = 0x179B,
#[error("Invalid migrated pool fee params")]
InvalidMigratedPoolFee = 0x179C,
#[error("Undertermined error")]
UndeterminedError = 0x179D,
#[error("Rate limiter not supported")]
RateLimiterNotSupported = 0x179E,
#[error("Amount left is not zero")]
AmountLeftIsNotZero = 0x179F,
#[error("Next sqrt price is smaller than start sqrt price")]
NextSqrtPriceIsSmallerThanStartSqrtPrice = 0x17A0,
#[error("Invalid min base fee")]
InvalidMinBaseFee = 0x17A1,
#[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)
}
}