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("Position is healthy")]
96 PositionIsHealthy = 0x19DE,
97 #[error("Position is already liquidated")]
99 PositionIsLiquidated = 0x19DF,
100 #[error("Position is unhealthy")]
102 PositionIsUnhealthy = 0x19E0,
103 #[error("Position is not empty")]
105 PositionNotEmpty = 0x19E1,
106 #[error("Position is empty")]
108 PositionIsEmpty = 0x19E2,
109 #[error("Unable to claim yield for auto re-balanceable positions")]
111 PositionIsAutoRebalanceable = 0x19E3,
112 #[error("Position size exceeds the maximum allowed value")]
114 PositionSizeLimitExceeded = 0x19E4,
115 #[error("Protocol fee is out of range")]
117 ProtocolFeeIsOutOfRange = 0x19F0,
118 #[error("Rebalance conditions are not met")]
120 RebalanceConditionsNotMet = 0x19F1,
121 #[error("Same accounts type is provided more than once")]
123 RemainingAccountsDuplicatedAccountsType = 0x19F2,
124 #[error("Invalid remaining accounts")]
126 RemainingAccountsInvalidSlice = 0x19F3,
127 #[error("Invalid remaining accounts slice length")]
129 RemainingAccountsInvalidSliceLength = 0x19F4,
130 #[error("Insufficient remaining accounts")]
132 RemainingAccountsInsufficient = 0x19F5,
133 #[error("Required remaining account is not provided")]
135 RequiredRemainingAccountNotProvided = 0x19F6,
136 #[error("Swap equation solver failed to t find the root")]
138 SolverFailedToFindRoot = 0x19F7,
139 #[error("Lending vault supply limit exceeded")]
141 SupplyLimitExceeded = 0x19F8,
142 #[error("Instruction is suspended")]
144 Suspended = 0x19F9,
145 #[error("Maximum allowed swap slippage is exceeded")]
147 SwapSlippageExceeded = 0x19FA,
148 #[error("Provided swap slippage value is out of range")]
150 SwapSlippageIsOutOfRange = 0x19FB,
151 #[error("Swap to position ratio estimation failed")]
153 SwapToPositionRatioEstimationFailed = 0x19FC,
154 #[error("Swap quote amount is not equal to the actual swap amount")]
156 SwapQuoteNotEqualToActualSwapAmount = 0x19FD,
157 #[error("Transfer fee calculation failed")]
159 TransferFeeCalculationError = 0x19FE,
160 #[error("Unable to load the account data")]
162 UnableToLoadAccountData = 0x19FF,
163 #[error("Unable to deserialize the account data")]
165 UnableToDeserializeAccountData = 0x1A00,
166 #[error("Unexpected value")]
168 UnexpectedValue = 0x1A01,
169 #[error("Token mint has unsupported attributes")]
171 UnsupportedTokenMint = 0x1A02,
172 #[error("Collected yield is zero")]
174 ZeroYield = 0x1A06,
175 #[error("Position amount is zero")]
177 ZeroAmount = 0x1A07,
178 #[error("Incorrect position direction")]
180 IncorrectPositionDirection = 0x1A0E,
181 #[error("Optional recipient account is not set")]
183 RecipientAccountIsNotSet = 0x1A0F,
184 #[error("Moving Average price deviation threshold exceeded")]
186 MAPriceDeviationThresholdExceeded = 0x1A10,
187 #[error("Invalid jupiter route data")]
189 InvalidJupiterRoute = 0x1A11,
190 #[error("Insufficient swap output amount")]
192 InsufficientSwapOutputAmount = 0x1A12,
193 #[error("Incorrect swap input amount")]
195 IncorrectSwapInputAmount = 0x1A13,
196 #[error("Incorrect swap output amount")]
198 IncorrectSwapOutputAmount = 0x1A14,
199 #[error("Account is not initialized")]
201 AccountNotInitialized = 0x1A15,
202}
203
204impl From<TunaError> for solana_program_error::ProgramError {
205 fn from(e: TunaError) -> Self {
206 solana_program_error::ProgramError::Custom(e as u32)
207 }
208}
209