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 = 0x30D4,
16 #[error("Math overflow")]
18 MathOverflow = 0x30D5,
19 #[error("Math underflow")]
21 MathUnderflow = 0x30D6,
22 #[error("Lending vault is not initialized")]
24 VaultNotInitialized = 0x310F,
25 #[error("Withdraw request the exceeds user balance")]
27 WithdrawRequestExceedsUserBalance = 0x3110,
28 #[error("Zero price range: the lower price is equal to upper price)")]
30 ZeroPriceRange = 0x3111,
31 #[error("Amount slippage exceeded")]
33 AmountSlippageExceeded = 0x3138,
34 #[error("Bad debt is not allowed for the executed instruction")]
36 BadDebt = 0x3139,
37 #[error("Invalid number of remaining accounts")]
39 InvalidRemainingAccountsLength = 0x313A,
40 #[error("Invalid instruction arguments")]
42 InvalidInstructionArguments = 0x313B,
43 #[error("Invalid market maker")]
45 InvalidMarketMaker = 0x313C,
46 #[error("Invalid account discriminator")]
48 InvalidAccountDiscriminator = 0x313D,
49 #[error("Invalid account owner")]
51 InvalidAccountOwner = 0x313E,
52 #[error("Invalid Fusion or Orca pool")]
54 InvalidPool = 0x313F,
55 #[error("Vault address is invalid")]
57 InvalidVault = 0x3140,
58 #[error("Insufficient liquidity")]
60 InsufficientLiquidity = 0x3141,
61 #[error("Interest rate is out of range")]
63 InterestRateIsOutOfRange = 0x3142,
64 #[error("Leverage is out or range")]
66 LeverageIsOutOfRange = 0x3143,
67 #[error("Leftovers percentage exceeded the maximum allowed value")]
69 LeftoversExceeded = 0x3144,
70 #[error("Liquidation fee is out of range")]
72 LiquidationFeeIsOutOfRange = 0x3145,
73 #[error("Liquidation threshold is out of range")]
75 LiquidationThresholdIsOutOfRange = 0x3146,
76 #[error("Market is disabled")]
78 MarketDisabled = 0x3147,
79 #[error("Exceed the maximum allowed debt for the market")]
81 MarketDebtLimitExceeded = 0x3148,
82 #[error("Unable to call transfer hook without extra accounts")]
84 NoExtraAccountsForTransferHook = 0x3149,
85 #[error("Oracle price is stale")]
87 OracleStalePrice = 0x314A,
88 #[error("Oracle price deviation threshold exceeded")]
90 OraclePriceDeviationThresholdExceeded = 0x314B,
91 #[error("Oracle price deviation threshold out of range")]
93 OraclePriceDeviationThresholdOutOfRange = 0x314C,
94 #[error("Position is healthy")]
96 PositionIsHealthy = 0x314E,
97 #[error("Position is already liquidated")]
99 PositionIsLiquidated = 0x314F,
100 #[error("Position is unhealthy")]
102 PositionIsUnhealthy = 0x3150,
103 #[error("Position is not empty")]
105 PositionNotEmpty = 0x3151,
106 #[error("Position is empty")]
108 PositionIsEmpty = 0x3152,
109 #[error("Unable to claim yield for auto re-balanceable positions")]
111 PositionIsAutoRebalanceable = 0x3153,
112 #[error("Position size exceeds the maximum allowed value")]
114 PositionSizeLimitExceeded = 0x3154,
115 #[error("Protocol fee is out of range")]
117 ProtocolFeeIsOutOfRange = 0x3160,
118 #[error("Rebalance conditions are not met")]
120 RebalanceConditionsNotMet = 0x3161,
121 #[error("Same accounts type is provided more than once")]
123 RemainingAccountsDuplicatedAccountsType = 0x3162,
124 #[error("Invalid remaining accounts")]
126 RemainingAccountsInvalidSlice = 0x3163,
127 #[error("Invalid remaining accounts slice length")]
129 RemainingAccountsInvalidSliceLength = 0x3164,
130 #[error("Insufficient remaining accounts")]
132 RemainingAccountsInsufficient = 0x3165,
133 #[error("Required remaining account is not provided")]
135 RequiredRemainingAccountNotProvided = 0x3166,
136 #[error("Swap equation solver failed to t find the root")]
138 SolverFailedToFindRoot = 0x3167,
139 #[error("Lending vault supply limit exceeded")]
141 SupplyLimitExceeded = 0x3168,
142 #[error("Instruction is suspended")]
144 Suspended = 0x3169,
145 #[error("Maximum allowed swap slippage is exceeded")]
147 SwapSlippageExceeded = 0x316A,
148 #[error("Provided swap slippage value is out of range")]
150 SwapSlippageIsOutOfRange = 0x316B,
151 #[error("Swap to position ratio estimation failed")]
153 SwapToPositionRatioEstimationFailed = 0x316C,
154 #[error("Swap quote amount is not equal to the actual swap amount")]
156 SwapQuoteNotEqualToActualSwapAmount = 0x316D,
157 #[error("Transfer fee calculation failed")]
159 TransferFeeCalculationError = 0x316E,
160 #[error("Unable to load the account data")]
162 UnableToLoadAccountData = 0x316F,
163 #[error("Unable to deserialize the account data")]
165 UnableToDeserializeAccountData = 0x3170,
166 #[error("Unexpected value")]
168 UnexpectedValue = 0x3171,
169 #[error("Token mint has unsupported attributes")]
171 UnsupportedTokenMint = 0x3172,
172 #[error("Collected yield is zero")]
174 ZeroYield = 0x3176,
175 #[error("Position amount is zero")]
177 ZeroAmount = 0x3177,
178 #[error("Incorrect position direction")]
180 IncorrectPositionDirection = 0x317E,
181 #[error("Optional recipient account is not set")]
183 RecipientAccountIsNotSet = 0x317F,
184 #[error("Moving Average price deviation threshold exceeded")]
186 MAPriceDeviationThresholdExceeded = 0x3180,
187 #[error("Invalid jupiter route data")]
189 InvalidJupiterRoute = 0x3181,
190 #[error("Insufficient swap output amount")]
192 InsufficientSwapOutputAmount = 0x3182,
193 #[error("Incorrect swap input amount")]
195 IncorrectSwapInputAmount = 0x3183,
196 #[error("Incorrect swap output amount")]
198 IncorrectSwapOutputAmount = 0x3184,
199 #[error("Account is not initialized")]
201 AccountNotInitialized = 0x3185,
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