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