orca_sol/errors/
whirlpool.rs1use num_derive::FromPrimitive;
9use thiserror::Error;
10
11#[derive(Clone, Debug, Eq, Error, FromPrimitive, PartialEq)]
12pub enum WhirlpoolError {
13 #[error("Enum value could not be converted")]
15 InvalidEnum = 0x1770,
16 #[error("Invalid start tick index provided.")]
18 InvalidStartTick = 0x1771,
19 #[error("Tick-array already exists in this whirlpool")]
21 TickArrayExistInPool = 0x1772,
22 #[error("Attempt to search for a tick-array failed")]
24 TickArrayIndexOutofBounds = 0x1773,
25 #[error("Tick-spacing is not supported")]
27 InvalidTickSpacing = 0x1774,
28 #[error("Position is not empty It cannot be closed")]
30 ClosePositionNotEmpty = 0x1775,
31 #[error("Unable to divide by zero")]
33 DivideByZero = 0x1776,
34 #[error("Unable to cast number into BigInt")]
36 NumberCastError = 0x1777,
37 #[error("Unable to down cast number")]
39 NumberDownCastError = 0x1778,
40 #[error("Tick not found within tick array")]
42 TickNotFound = 0x1779,
43 #[error("Provided tick index is either out of bounds or uninitializable")]
45 InvalidTickIndex = 0x177A,
46 #[error("Provided sqrt price out of bounds")]
48 SqrtPriceOutOfBounds = 0x177B,
49 #[error("Liquidity amount must be greater than zero")]
51 LiquidityZero = 0x177C,
52 #[error("Liquidity amount must be less than i64::MAX")]
54 LiquidityTooHigh = 0x177D,
55 #[error("Liquidity overflow")]
57 LiquidityOverflow = 0x177E,
58 #[error("Liquidity underflow")]
60 LiquidityUnderflow = 0x177F,
61 #[error("Tick liquidity net underflowed or overflowed")]
63 LiquidityNetError = 0x1780,
64 #[error("Exceeded token max")]
66 TokenMaxExceeded = 0x1781,
67 #[error("Did not meet token min")]
69 TokenMinSubceeded = 0x1782,
70 #[error("Position token account has a missing or invalid delegate")]
72 MissingOrInvalidDelegate = 0x1783,
73 #[error("Position token amount must be 1")]
75 InvalidPositionTokenAmount = 0x1784,
76 #[error("Timestamp should be convertible from i64 to u64")]
78 InvalidTimestampConversion = 0x1785,
79 #[error("Timestamp should be greater than the last updated timestamp")]
81 InvalidTimestamp = 0x1786,
82 #[error("Invalid tick array sequence provided for instruction.")]
84 InvalidTickArraySequence = 0x1787,
85 #[error("Token Mint in wrong order")]
87 InvalidTokenMintOrder = 0x1788,
88 #[error("Reward not initialized")]
90 RewardNotInitialized = 0x1789,
91 #[error("Invalid reward index")]
93 InvalidRewardIndex = 0x178A,
94 #[error("Reward vault requires amount to support emissions for at least one day")]
96 RewardVaultAmountInsufficient = 0x178B,
97 #[error("Exceeded max fee rate")]
99 FeeRateMaxExceeded = 0x178C,
100 #[error("Exceeded max protocol fee rate")]
102 ProtocolFeeRateMaxExceeded = 0x178D,
103 #[error("Multiplication with shift right overflow")]
105 MultiplicationShiftRightOverflow = 0x178E,
106 #[error("Muldiv overflow")]
108 MulDivOverflow = 0x178F,
109 #[error("Invalid div_u256 input")]
111 MulDivInvalidInput = 0x1790,
112 #[error("Multiplication overflow")]
114 MultiplicationOverflow = 0x1791,
115 #[error("Provided SqrtPriceLimit not in the same direction as the swap.")]
117 InvalidSqrtPriceLimitDirection = 0x1792,
118 #[error("There are no tradable amount to swap.")]
120 ZeroTradableAmount = 0x1793,
121 #[error("Amount out below minimum threshold")]
123 AmountOutBelowMinimum = 0x1794,
124 #[error("Amount in above maximum threshold")]
126 AmountInAboveMaximum = 0x1795,
127 #[error("Invalid index for tick array sequence")]
129 TickArraySequenceInvalidIndex = 0x1796,
130 #[error("Amount calculated overflows")]
132 AmountCalcOverflow = 0x1797,
133 #[error("Amount remaining overflows")]
135 AmountRemainingOverflow = 0x1798,
136 #[error("Invalid intermediary mint")]
138 InvalidIntermediaryMint = 0x1799,
139 #[error("Duplicate two hop pool")]
141 DuplicateTwoHopPool = 0x179A,
142 #[error("Bundle index is out of bounds")]
144 InvalidBundleIndex = 0x179B,
145 #[error("Position has already been opened")]
147 BundledPositionAlreadyOpened = 0x179C,
148 #[error("Position has already been closed")]
150 BundledPositionAlreadyClosed = 0x179D,
151 #[error("Unable to delete PositionBundle with open positions")]
153 PositionBundleNotDeletable = 0x179E,
154 #[error("Token mint has unsupported attributes")]
156 UnsupportedTokenMint = 0x179F,
157 #[error("Invalid remaining accounts")]
159 RemainingAccountsInvalidSlice = 0x17A0,
160 #[error("Insufficient remaining accounts")]
162 RemainingAccountsInsufficient = 0x17A1,
163 #[error("Unable to call transfer hook without extra accounts")]
165 NoExtraAccountsForTransferHook = 0x17A2,
166 #[error("Output and input amount mismatch")]
168 IntermediateTokenAmountMismatch = 0x17A3,
169 #[error("Transfer fee calculation failed")]
171 TransferFeeCalculationError = 0x17A4,
172 #[error("Same accounts type is provided more than once")]
174 RemainingAccountsDuplicatedAccountsType = 0x17A5,
175 #[error("This whirlpool only supports full-range positions")]
177 FullRangeOnlyPool = 0x17A6,
178 #[error("Too many supplemental tick arrays provided")]
180 TooManySupplementalTickArrays = 0x17A7,
181 #[error("TickArray account for different whirlpool provided")]
183 DifferentWhirlpoolTickArrayAccount = 0x17A8,
184 #[error("Trade resulted in partial fill")]
186 PartialFillError = 0x17A9,
187 #[error("Position is not lockable")]
189 PositionNotLockable = 0x17AA,
190 #[error("Operation not allowed on locked position")]
192 OperationNotAllowedOnLockedPosition = 0x17AB,
193 #[error("Cannot reset position range with same tick range")]
195 SameTickRangeNotAllowed = 0x17AC,
196 #[error("Invalid adaptive fee constants")]
198 InvalidAdaptiveFeeConstants = 0x17AD,
199 #[error("Invalid fee tier index")]
201 InvalidFeeTierIndex = 0x17AE,
202 #[error("Invalid trade enable timestamp")]
204 InvalidTradeEnableTimestamp = 0x17AF,
205 #[error("Trade is not enabled yet")]
207 TradeIsNotEnabled = 0x17B0,
208}
209
210impl solana_program_error::PrintProgramError for WhirlpoolError {
211 fn print<E>(&self) {
212 solana_msg::msg!(&self.to_string());
213 }
214}
215
216impl<T> solana_decode_error::DecodeError<T> for WhirlpoolError {
217 fn type_of() -> &'static str {
218 "WhirlpoolError"
219 }
220}