use num_derive::FromPrimitive;
use thiserror::Error;
#[derive(Clone, Debug, Eq, Error, FromPrimitive, PartialEq)]
pub enum FusionammError {
#[error("Enum value could not be converted")]
InvalidEnum = 0x1770,
#[error("Invalid start tick index provided.")]
InvalidStartTick = 0x1771,
#[error("Tick-array already exists in this fusion_pool")]
TickArrayExistInPool = 0x1772,
#[error("Attempt to search for a tick-array failed")]
TickArrayIndexOutofBounds = 0x1773,
#[error("Tick-spacing is not supported")]
InvalidTickSpacing = 0x1774,
#[error("Position is not empty It cannot be closed")]
ClosePositionNotEmpty = 0x1775,
#[error("Unable to divide by zero")]
DivideByZero = 0x1776,
#[error("Unable to cast number into BigInt")]
NumberCastError = 0x1777,
#[error("Unable to down cast number")]
NumberDownCastError = 0x1778,
#[error("Tick not found within tick array")]
TickNotFound = 0x1779,
#[error("Provided tick index is either out of bounds or uninitializable")]
InvalidTickIndex = 0x177A,
#[error("Provided sqrt price out of bounds")]
SqrtPriceOutOfBounds = 0x177B,
#[error("Liquidity amount must be greater than zero")]
LiquidityZero = 0x177C,
#[error("Liquidity amount must be less than i64::MAX")]
LiquidityTooHigh = 0x177D,
#[error("Liquidity overflow")]
LiquidityOverflow = 0x177E,
#[error("Liquidity underflow")]
LiquidityUnderflow = 0x177F,
#[error("Tick liquidity net underflowed or overflowed")]
LiquidityNetError = 0x1780,
#[error("Exceeded token max")]
TokenMaxExceeded = 0x1781,
#[error("Did not meet token min")]
TokenMinSubceeded = 0x1782,
#[error("Position token account has a missing or invalid delegate")]
MissingOrInvalidDelegate = 0x1783,
#[error("Position token amount must be 1")]
InvalidPositionTokenAmount = 0x1784,
#[error("Timestamp should be convertible from i64 to u64")]
InvalidTimestampConversion = 0x1785,
#[error("Timestamp should be greater than the last updated timestamp")]
InvalidTimestamp = 0x1786,
#[error("Invalid tick array sequence provided for instruction.")]
InvalidTickArraySequence = 0x1787,
#[error("Token Mint in wrong order")]
InvalidTokenMintOrder = 0x1788,
#[error("Position is not empty, range can't be set.")]
SetRangeForNonEmptyPosition = 0x1789,
#[error("Exceeded reward ratio of concentrated liquidity providers to limit orders' liquidity providers")]
ClpRewardRateMaxExceeded = 0x178A,
#[error("Reward vault requires amount to support emissions for at least one day")]
RewardVaultAmountInsufficient = 0x178B,
#[error("Exceeded max fee rate")]
FeeRateMaxExceeded = 0x178C,
#[error("Exceeded max protocol fee rate")]
ProtocolFeeRateMaxExceeded = 0x178D,
#[error("Multiplication with shift right overflow")]
MultiplicationShiftRightOverflow = 0x178E,
#[error("Muldiv overflow")]
MulDivOverflow = 0x178F,
#[error("Invalid div_u256 input")]
MulDivInvalidInput = 0x1790,
#[error("Multiplication overflow")]
MultiplicationOverflow = 0x1791,
#[error("Provided SqrtPriceLimit not in the same direction as the swap.")]
InvalidSqrtPriceLimitDirection = 0x1792,
#[error("There are no tradable amount to swap.")]
ZeroTradableAmount = 0x1793,
#[error("Amount out below minimum threshold")]
AmountOutBelowMinimum = 0x1794,
#[error("Amount in above maximum threshold")]
AmountInAboveMaximum = 0x1795,
#[error("Invalid index for tick array sequence")]
TickArraySequenceInvalidIndex = 0x1796,
#[error("Amount calculated overflows")]
AmountCalcOverflow = 0x1797,
#[error("Amount remaining overflows")]
AmountRemainingOverflow = 0x1798,
#[error("Invalid intermediary mint")]
InvalidIntermediaryMint = 0x1799,
#[error("Duplicate two hop pool")]
DuplicateTwoHopPool = 0x179A,
#[error("Bundle index is out of bounds")]
InvalidBundleIndex = 0x179B,
#[error("Position has already been opened")]
BundledPositionAlreadyOpened = 0x179C,
#[error("Position has already been closed")]
BundledPositionAlreadyClosed = 0x179D,
#[error("Unable to delete PositionBundle with open positions")]
PositionBundleNotDeletable = 0x179E,
#[error("Token mint has unsupported attributes")]
UnsupportedTokenMint = 0x179F,
#[error("Invalid remaining accounts")]
RemainingAccountsInvalidSlice = 0x17A0,
#[error("Insufficient remaining accounts")]
RemainingAccountsInsufficient = 0x17A1,
#[error("Unable to call transfer hook without extra accounts")]
NoExtraAccountsForTransferHook = 0x17A2,
#[error("Output and input amount mismatch")]
IntermediateTokenAmountMismatch = 0x17A3,
#[error("Transfer fee calculation failed")]
TransferFeeCalculationError = 0x17A4,
#[error("Same accounts type is provided more than once")]
RemainingAccountsDuplicatedAccountsType = 0x17A5,
#[error("This fusion_pool only supports full-range positions")]
FullRangeOnlyPool = 0x17A6,
#[error("Too many supplemental tick arrays provided")]
TooManySupplementalTickArrays = 0x17A7,
#[error("TickArray account for different fusion_pool provided")]
DifferentFusionPoolTickArrayAccount = 0x17A8,
#[error("Trade resulted in partial fill")]
PartialFillError = 0x17A9,
#[error("The limit order tick index is incorrect relative to the current market tick (taker order)")]
TakerOrderNotSupported = 0x17AA,
#[error("Exceeded the limit order deposited input amount")]
LimitOrderAmountExceeded = 0x17AB,
#[error("Limit order is not empty and cannot be closed")]
LimitOrderNotEmpty = 0x17AC,
#[error("Unable to increase a limit order because it's partially or fully filled")]
LimitOrderIsFilled = 0x17AD,
#[error("Zero amount")]
ZeroAmount = 0x17AE,
#[error("Can't reset the price because a pool is not empty")]
ResetPriceForNonEmptyPool = 0x17AF,
}
impl From<FusionammError> for solana_program_error::ProgramError {
fn from(e: FusionammError) -> Self {
solana_program_error::ProgramError::Custom(e as u32)
}
}