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("Enum value could not be converted")]
15 InvalidEnum = 0x1963,
16 #[error("Type cast overflow")]
18 TypeCastOverflow = 0x1964,
19 #[error("Math overflow")]
21 MathOverflow = 0x1965,
22 #[error("Math underflow")]
24 MathUnderflow = 0x1966,
25 #[error("Lending vault is not initialized")]
27 VaultNotInitialized = 0x199F,
28 #[error("Withdraw request the exceeds user balance")]
30 WithdrawRequestExceedsUserBalance = 0x19A0,
31 #[error("Zero price range: the lower price is equal to upper price)")]
33 ZeroPriceRange = 0x19A1,
34 #[error("Amount slippage exceeded")]
36 AmountSlippageExceeded = 0x19C8,
37 #[error("Bad debt is not allowed for the executed instruction")]
39 BadDebt = 0x19C9,
40 #[error("Invalid number of remaining accounts")]
42 InvalidRemainingAccountsLength = 0x19CA,
43 #[error("Invalid instruction arguments")]
45 InvalidInstructionArguments = 0x19CB,
46 #[error("Invalid market maker")]
48 InvalidMarketMaker = 0x19CC,
49 #[error("Invalid account discriminator")]
51 InvalidAccountDiscriminator = 0x19CD,
52 #[error("Invalid account owner")]
54 InvalidAccountOwner = 0x19CE,
55 #[error("Invalid Fusion or Orca pool")]
57 InvalidPool = 0x19CF,
58 #[error("Vault address is invalid")]
60 InvalidVault = 0x19D0,
61 #[error("Insufficient liquidity")]
63 InsufficientLiquidity = 0x19D1,
64 #[error("Interest rate is out of range")]
66 InterestRateIsOutOfRange = 0x19D2,
67 #[error("Leverage is out or range")]
69 LeverageIsOutOfRange = 0x19D3,
70 #[error("Leftovers percentage exceeded the maximum allowed value")]
72 LeftoversExceeded = 0x19D4,
73 #[error("Liquidation fee is out of range")]
75 LiquidationFeeIsOutOfRange = 0x19D5,
76 #[error("Liquidation threshold is out of range")]
78 LiquidationThresholdIsOutOfRange = 0x19D6,
79 #[error("Market is disabled")]
81 MarketDisabled = 0x19D7,
82 #[error("Exceed the maximum allowed debt for the market")]
84 MarketDebtLimitExceeded = 0x19D8,
85 #[error("Unable to call transfer hook without extra accounts")]
87 NoExtraAccountsForTransferHook = 0x19D9,
88 #[error("Oracle price is stale")]
90 OracleStalePrice = 0x19DA,
91 #[error("Oracle price deviation threshold exceeded")]
93 OraclePriceDeviationThresholdExceeded = 0x19DB,
94 #[error("Oracle price deviation threshold out of range")]
96 OraclePriceDeviationThresholdOutOfRange = 0x19DC,
97 #[error("Invalid oracle price update account")]
99 InvalidPriceUpdateAccount = 0x19DD,
100 #[error("Position is healthy")]
102 PositionIsHealthy = 0x19DE,
103 #[error("Position is already liquidated")]
105 PositionIsLiquidated = 0x19DF,
106 #[error("Position is unhealthy")]
108 PositionIsUnhealthy = 0x19E0,
109 #[error("Position is not empty")]
111 PositionNotEmpty = 0x19E1,
112 #[error("Position is empty")]
114 PositionIsEmpty = 0x19E2,
115 #[error("Unable to claim yield for auto re-balanceable positions")]
117 PositionIsAutoRebalanceable = 0x19E3,
118 #[error("Position size exceeds the maximum allowed value")]
120 PositionSizeLimitExceeded = 0x19E4,
121 #[error("Protocol fee is out of range")]
123 ProtocolFeeIsOutOfRange = 0x19F0,
124 #[error("Rebalance conditions are not met")]
126 RebalanceConditionsNotMet = 0x19F1,
127 #[error("Same accounts type is provided more than once")]
129 RemainingAccountsDuplicatedAccountsType = 0x19F2,
130 #[error("Invalid remaining accounts")]
132 RemainingAccountsInvalidSlice = 0x19F3,
133 #[error("Invalid remaining accounts slice length")]
135 RemainingAccountsInvalidSliceLength = 0x19F4,
136 #[error("Insufficient remaining accounts")]
138 RemainingAccountsInsufficient = 0x19F5,
139 #[error("Required remaining account is not provided")]
141 RequiredRemainingAccountNotProvided = 0x19F6,
142 #[error("Swap equation solver failed to t find the root")]
144 SolverFailedToFindRoot = 0x19F7,
145 #[error("Lending vault supply limit exceeded")]
147 SupplyLimitExceeded = 0x19F8,
148 #[error("Instruction is suspended")]
150 Suspended = 0x19F9,
151 #[error("Maximum allowed swap slippage is exceeded")]
153 SwapSlippageExceeded = 0x19FA,
154 #[error("Provided swap slippage value is out of range")]
156 SwapSlippageIsOutOfRange = 0x19FB,
157 #[error("Swap to position ratio estimation failed")]
159 SwapToPositionRatioEstimationFailed = 0x19FC,
160 #[error("Swap quote amount is not equal to the actual swap amount")]
162 SwapQuoteNotEqualToActualSwapAmount = 0x19FD,
163 #[error("Transfer fee calculation failed")]
165 TransferFeeCalculationError = 0x19FE,
166 #[error("Unable to load the account data")]
168 UnableToLoadAccountData = 0x19FF,
169 #[error("Unable to deserialize the account data")]
171 UnableToDeserializeAccountData = 0x1A00,
172 #[error("Unexpected value")]
174 UnexpectedValue = 0x1A01,
175 #[error("Token mint has unsupported attributes")]
177 UnsupportedTokenMint = 0x1A02,
178 #[error("Collected yield is zero")]
180 ZeroYield = 0x1A06,
181 #[error("Zero bad debt")]
183 ZeroBadDebt = 0x1A08,
184 #[error("Incorrect position direction")]
186 IncorrectPositionDirection = 0x1A0E,
187 #[error("Optional recipient account is not set")]
189 RecipientAccountIsNotSet = 0x1A0F,
190 #[error("Moving Average price deviation threshold exceeded")]
192 MAPriceDeviationThresholdExceeded = 0x1A10,
193 #[error("Account is not initialized")]
195 AccountNotInitialized = 0x1A11,
196 #[error("Position is locked")]
198 PositionLocked = 0x1A12,
199 #[error("Leveraged locked position is not allowed")]
201 LeveragedLockedPositionNotAllowed = 0x1A13,
202 #[error("Vault is not empty")]
204 VaultNotEmpty = 0x1A14,
205 #[error("The market has opened positions and can't be closed")]
207 MarketHasOpenedPositions = 0x1A15,
208 #[error("Invalid jupiter create token account instruction data")]
210 InvalidJupiterCreateTokenAccountInstructionData = 0x1A2C,
211 #[error("Invalid jupiter create token account instruction user account")]
213 InvalidJupiterCreateTokenAccountUserAccount = 0x1A2D,
214 #[error("Invalid jupiter route instruction data")]
216 InvalidJupiterRouteInstructionData = 0x1A2E,
217 #[error("Invalid jupiter route instruction")]
219 InvalidJupiterRouteInstructionAccount = 0x1A2F,
220 #[error("Insufficient swap output amount")]
222 InsufficientJupiterSwapOutputAmount = 0x1A30,
223 #[error("Incorrect swap input amount")]
225 IncorrectJupiterSwapInputAmount = 0x1A31,
226}
227
228impl From<TunaError> for solana_program_error::ProgramError {
229 fn from(e: TunaError) -> Self {
230 solana_program_error::ProgramError::Custom(e as u32)
231 }
232}
233