defituna_client/generated/errors/
tuna.rs1use num_derive::FromPrimitive;
9use thiserror::Error;
10
11#[derive(Clone, Debug, Eq, Error, FromPrimitive, PartialEq)]
12pub enum TunaError {
13 #[error("Amount slippage exceeded")]
15 AmountSlippageExceeded = 0x1770,
16 #[error("Bad debt is not allowed for the executed instruction")]
18 BadDebt = 0x1771,
19 #[error("Invalid number of remaining accounts")]
21 InvalidRemainingAccountsLength = 0x1772,
22 #[error("Invalid account owner")]
24 InvalidAccountOwner = 0x1773,
25 #[error("Invalid instruction arguments")]
27 InvalidInstructionArguments = 0x1774,
28 #[error("Invalid market maker")]
30 InvalidMarketMaker = 0x1775,
31 #[error("Provided SqrtPriceLimit not in the same direction as the swap.")]
33 InvalidSqrtPriceLimitDirection = 0x1776,
34 #[error("Invalid tick array sequence provided for instruction")]
36 InvalidTickArraySequence = 0x1777,
37 #[error("Insufficient liquidity")]
39 InsufficientLiquidity = 0x1778,
40 #[error("Interest rate is out of range")]
42 InterestRateIsOutOfRange = 0x1779,
43 #[error("Leverage is out or range")]
45 LeverageIsOutOfRange = 0x177A,
46 #[error("Leftovers percentage exceeded the maximum allowed value")]
48 LeftoversExceeded = 0x177B,
49 #[error("Limit order execution fee is out of range")]
51 LimitOrderExecutionFeeIsOutOfRange = 0x177C,
52 #[error("Liquidation fee is out of range")]
54 LiquidationFeeIsOutOfRange = 0x177D,
55 #[error("Liquidation threshold is out of range")]
57 LiquidationThresholdIsOutOfRange = 0x177E,
58 #[error("Liquidity amount must be greater than zero.")]
60 LiquidityZero = 0x177F,
61 #[error("Market is disabled")]
63 MarketDisabled = 0x1780,
64 #[error("Exceed the maximum allowed debt for the market")]
66 MarketDebtLimitExceeded = 0x1781,
67 #[error("Math overflow")]
69 MathOverflow = 0x1782,
70 #[error("Math underflow")]
72 MathUnderflow = 0x1783,
73 #[error("Unable to call transfer hook without extra accounts")]
75 NoExtraAccountsForTransferHook = 0x1784,
76 #[error("Oracle price is stale")]
78 OracleStalePrice = 0x1785,
79 #[error("OraclePriceDeviationThresholdExceeded")]
81 OraclePriceDeviationThresholdExceeded = 0x1786,
82 #[error("OraclePriceDeviationThresholdOutOfRange")]
84 OraclePriceDeviationThresholdOutOfRange = 0x1787,
85 #[error("Trade resulted in partial fill")]
87 PartialFillError = 0x1788,
88 #[error("Position is healthy")]
90 PositionIsHealthy = 0x1789,
91 #[error("Position is already liquidated")]
93 PositionIsLiquidated = 0x178A,
94 #[error("Position is unhealthy")]
96 PositionIsUnhealthy = 0x178B,
97 #[error("Position is not empty")]
99 PositionNotEmpty = 0x178C,
100 #[error("Protocol fee is out of range")]
102 ProtocolFeeIsOutOfRange = 0x178D,
103 #[error("Rebalance conditions are not met")]
105 RebalanceConditionsNotMet = 0x178E,
106 #[error("Same accounts type is provided more than once")]
108 RemainingAccountsDuplicatedAccountsType = 0x178F,
109 #[error("Invalid remaining accounts")]
111 RemainingAccountsInvalidSlice = 0x1790,
112 #[error("Invalid remaining accounts slice length")]
114 RemainingAccountsInvalidSliceLength = 0x1791,
115 #[error("Insufficient remaining accounts")]
117 RemainingAccountsInsufficient = 0x1792,
118 #[error("Required remaining account is not provided")]
120 RequiredRemainingAccountNotProvided = 0x1793,
121 #[error("Swap equation solver failed to t find the root")]
123 SolverFailedToFindRoot = 0x1794,
124 #[error("Provided sqrt price out of bounds")]
126 SqrtPriceOutOfBounds = 0x1795,
127 #[error("Lending vault supply limit exceeded")]
129 SupplyLimitExceeded = 0x1796,
130 #[error("Instruction is suspended")]
132 Suspended = 0x1797,
133 #[error("Maximum allowed swap slippage is exceeded")]
135 SwapSlippageExceeded = 0x1798,
136 #[error("Provided swap slippage value is out of range")]
138 SwapSlippageIsOutOfRange = 0x1799,
139 #[error("Swap to position ratio estimation failed")]
141 SwapToPositionRatioEstimationFailed = 0x179A,
142 #[error("Swap quote amount is not equal to the actual swap amount")]
144 SwapQuoteNotEqualToActualSwapAmount = 0x179B,
145 #[error("Tick index is out of bounds")]
147 TickIndexOfBounds = 0x179C,
148 #[error("Transfer fee calculation failed")]
150 TransferFeeCalculationError = 0x179D,
151 #[error("Type cast overflow")]
153 TypeCastOverflow = 0x179E,
154 #[error("Unable to load the account data")]
156 UnableToLoadAccountData = 0x179F,
157 #[error("Unable to deserialize the account data")]
159 UnableToDeserializeAccountData = 0x17A0,
160 #[error("Unexpected value")]
162 UnexpectedValue = 0x17A1,
163 #[error("Token mint has unsupported attributes")]
165 UnsupportedTokenMint = 0x17A2,
166 #[error("Lending vault is not initialized")]
168 VaultNotInitialized = 0x17A3,
169 #[error("Withdraw request the exceeds user balance")]
171 WithdrawRequestExceedsUserBalance = 0x17A4,
172 #[error("Zero price range: the lower price is equal to upper price)")]
174 ZeroPriceRange = 0x17A5,
175 #[error("There are no tradable amount to swap.")]
177 ZeroTradableAmount = 0x17A6,
178 #[error("Collected yield is zero")]
180 ZeroYield = 0x17A7,
181 #[error("RaydiumInvalidFirstTickArrayAccount")]
183 RaydiumInvalidFirstTickArrayAccount = 0x17A8,
184 #[error("RaydiumInvalidTickArray")]
186 RaydiumInvalidTickArray = 0x17A9,
187 #[error("RaydiumInvaildTickIndex")]
189 RaydiumInvaildTickIndex = 0x17AA,
190 #[error("RaydiumMaxTokenOverflow")]
192 RaydiumMaxTokenOverflow = 0x17AB,
193 #[error("RaydiumNotEnoughTickArrayAccount")]
195 RaydiumNotEnoughTickArrayAccount = 0x17AC,
196 #[error("RaydiumSqrtPriceLimitOverflow")]
198 RaydiumSqrtPriceLimitOverflow = 0x17AD,
199 #[error("RaydiumZeroAmountSpecified")]
201 RaydiumZeroAmountSpecified = 0x17AE,
202}
203
204impl solana_program::program_error::PrintProgramError for TunaError {
205 fn print<E>(&self) {
206 solana_program::msg!(&self.to_string());
207 }
208}
209
210impl<T> solana_program::decode_error::DecodeError<T> for TunaError {
211 fn type_of() -> &'static str {
212 "TunaError"
213 }
214}
215