defituna_client/generated/errors/
tuna.rs

1//! This code was AUTOGENERATED using the codama library.
2//! Please DO NOT EDIT THIS FILE, instead use visitors
3//! to add features, then rerun codama to update it.
4//!
5//! <https://github.com/codama-idl/codama>
6//!
7
8use num_derive::FromPrimitive;
9use thiserror::Error;
10
11#[derive(Clone, Debug, Eq, Error, FromPrimitive, PartialEq)]
12pub enum TunaError {
13    /// 12500 - Type cast overflow
14    #[error("Type cast overflow")]
15    TypeCastOverflow = 0x30D4,
16    /// 12501 - Math overflow
17    #[error("Math overflow")]
18    MathOverflow = 0x30D5,
19    /// 12502 - Math underflow
20    #[error("Math underflow")]
21    MathUnderflow = 0x30D6,
22    /// 12559 - Lending vault is not initialized
23    #[error("Lending vault is not initialized")]
24    VaultNotInitialized = 0x310F,
25    /// 12560 - Withdraw request the exceeds user balance
26    #[error("Withdraw request the exceeds user balance")]
27    WithdrawRequestExceedsUserBalance = 0x3110,
28    /// 12561 - Zero price range: the lower price is equal to upper price)
29    #[error("Zero price range: the lower price is equal to upper price)")]
30    ZeroPriceRange = 0x3111,
31    /// 12600 - Amount slippage exceeded
32    #[error("Amount slippage exceeded")]
33    AmountSlippageExceeded = 0x3138,
34    /// 12601 - Bad debt is not allowed for the executed instruction
35    #[error("Bad debt is not allowed for the executed instruction")]
36    BadDebt = 0x3139,
37    /// 12602 - Invalid number of remaining accounts
38    #[error("Invalid number of remaining accounts")]
39    InvalidRemainingAccountsLength = 0x313A,
40    /// 12603 - Invalid instruction arguments
41    #[error("Invalid instruction arguments")]
42    InvalidInstructionArguments = 0x313B,
43    /// 12604 - Invalid market maker
44    #[error("Invalid market maker")]
45    InvalidMarketMaker = 0x313C,
46    /// 12605 - Invalid account discriminator
47    #[error("Invalid account discriminator")]
48    InvalidAccountDiscriminator = 0x313D,
49    /// 12606 - Invalid account owner
50    #[error("Invalid account owner")]
51    InvalidAccountOwner = 0x313E,
52    /// 12607 - Invalid Fusion or Orca pool
53    #[error("Invalid Fusion or Orca pool")]
54    InvalidPool = 0x313F,
55    /// 12608 - Vault address is invalid
56    #[error("Vault address is invalid")]
57    InvalidVault = 0x3140,
58    /// 12609 - Insufficient liquidity
59    #[error("Insufficient liquidity")]
60    InsufficientLiquidity = 0x3141,
61    /// 12610 - Interest rate is out of range
62    #[error("Interest rate is out of range")]
63    InterestRateIsOutOfRange = 0x3142,
64    /// 12611 - Leverage is out or range
65    #[error("Leverage is out or range")]
66    LeverageIsOutOfRange = 0x3143,
67    /// 12612 - Leftovers percentage exceeded the maximum allowed value
68    #[error("Leftovers percentage exceeded the maximum allowed value")]
69    LeftoversExceeded = 0x3144,
70    /// 12613 - Liquidation fee is out of range
71    #[error("Liquidation fee is out of range")]
72    LiquidationFeeIsOutOfRange = 0x3145,
73    /// 12614 - Liquidation threshold is out of range
74    #[error("Liquidation threshold is out of range")]
75    LiquidationThresholdIsOutOfRange = 0x3146,
76    /// 12615 - Market is disabled
77    #[error("Market is disabled")]
78    MarketDisabled = 0x3147,
79    /// 12616 - Exceed the maximum allowed debt for the market
80    #[error("Exceed the maximum allowed debt for the market")]
81    MarketDebtLimitExceeded = 0x3148,
82    /// 12617 - Unable to call transfer hook without extra accounts
83    #[error("Unable to call transfer hook without extra accounts")]
84    NoExtraAccountsForTransferHook = 0x3149,
85    /// 12618 - Oracle price is stale
86    #[error("Oracle price is stale")]
87    OracleStalePrice = 0x314A,
88    /// 12619 - Oracle price deviation threshold exceeded
89    #[error("Oracle price deviation threshold exceeded")]
90    OraclePriceDeviationThresholdExceeded = 0x314B,
91    /// 12620 - Oracle price deviation threshold out of range
92    #[error("Oracle price deviation threshold out of range")]
93    OraclePriceDeviationThresholdOutOfRange = 0x314C,
94    /// 12622 - Position is healthy
95    #[error("Position is healthy")]
96    PositionIsHealthy = 0x314E,
97    /// 12623 - Position is already liquidated
98    #[error("Position is already liquidated")]
99    PositionIsLiquidated = 0x314F,
100    /// 12624 - Position is unhealthy
101    #[error("Position is unhealthy")]
102    PositionIsUnhealthy = 0x3150,
103    /// 12625 - Position is not empty
104    #[error("Position is not empty")]
105    PositionNotEmpty = 0x3151,
106    /// 12626 - Position is empty
107    #[error("Position is empty")]
108    PositionIsEmpty = 0x3152,
109    /// 12627 - Unable to claim yield for auto re-balanceable positions
110    #[error("Unable to claim yield for auto re-balanceable positions")]
111    PositionIsAutoRebalanceable = 0x3153,
112    /// 12628 - Position size exceeds the maximum allowed value
113    #[error("Position size exceeds the maximum allowed value")]
114    PositionSizeLimitExceeded = 0x3154,
115    /// 12640 - Protocol fee is out of range
116    #[error("Protocol fee is out of range")]
117    ProtocolFeeIsOutOfRange = 0x3160,
118    /// 12641 - Rebalance conditions are not met
119    #[error("Rebalance conditions are not met")]
120    RebalanceConditionsNotMet = 0x3161,
121    /// 12642 - Same accounts type is provided more than once
122    #[error("Same accounts type is provided more than once")]
123    RemainingAccountsDuplicatedAccountsType = 0x3162,
124    /// 12643 - Invalid remaining accounts
125    #[error("Invalid remaining accounts")]
126    RemainingAccountsInvalidSlice = 0x3163,
127    /// 12644 - Invalid remaining accounts slice length
128    #[error("Invalid remaining accounts slice length")]
129    RemainingAccountsInvalidSliceLength = 0x3164,
130    /// 12645 - Insufficient remaining accounts
131    #[error("Insufficient remaining accounts")]
132    RemainingAccountsInsufficient = 0x3165,
133    /// 12646 - Required remaining account is not provided
134    #[error("Required remaining account is not provided")]
135    RequiredRemainingAccountNotProvided = 0x3166,
136    /// 12647 - Swap equation solver failed to t find the root
137    #[error("Swap equation solver failed to t find the root")]
138    SolverFailedToFindRoot = 0x3167,
139    /// 12648 - Lending vault supply limit exceeded
140    #[error("Lending vault supply limit exceeded")]
141    SupplyLimitExceeded = 0x3168,
142    /// 12649 - Instruction is suspended
143    #[error("Instruction is suspended")]
144    Suspended = 0x3169,
145    /// 12650 - Maximum allowed swap slippage is exceeded
146    #[error("Maximum allowed swap slippage is exceeded")]
147    SwapSlippageExceeded = 0x316A,
148    /// 12651 - Provided swap slippage value is out of range
149    #[error("Provided swap slippage value is out of range")]
150    SwapSlippageIsOutOfRange = 0x316B,
151    /// 12652 - Swap to position ratio estimation failed
152    #[error("Swap to position ratio estimation failed")]
153    SwapToPositionRatioEstimationFailed = 0x316C,
154    /// 12653 - Swap quote amount is not equal to the actual swap amount
155    #[error("Swap quote amount is not equal to the actual swap amount")]
156    SwapQuoteNotEqualToActualSwapAmount = 0x316D,
157    /// 12654 - Transfer fee calculation failed
158    #[error("Transfer fee calculation failed")]
159    TransferFeeCalculationError = 0x316E,
160    /// 12655 - Unable to load the account data
161    #[error("Unable to load the account data")]
162    UnableToLoadAccountData = 0x316F,
163    /// 12656 - Unable to deserialize the account data
164    #[error("Unable to deserialize the account data")]
165    UnableToDeserializeAccountData = 0x3170,
166    /// 12657 - Unexpected value
167    #[error("Unexpected value")]
168    UnexpectedValue = 0x3171,
169    /// 12658 - Token mint has unsupported attributes
170    #[error("Token mint has unsupported attributes")]
171    UnsupportedTokenMint = 0x3172,
172    /// 12662 - Collected yield is zero
173    #[error("Collected yield is zero")]
174    ZeroYield = 0x3176,
175    /// 12663 - Position amount is zero
176    #[error("Position amount is zero")]
177    ZeroAmount = 0x3177,
178    /// 12670 - Incorrect position direction
179    #[error("Incorrect position direction")]
180    IncorrectPositionDirection = 0x317E,
181    /// 12671 - Optional recipient account is not set
182    #[error("Optional recipient account is not set")]
183    RecipientAccountIsNotSet = 0x317F,
184    /// 12672 - Moving Average price deviation threshold exceeded
185    #[error("Moving Average price deviation threshold exceeded")]
186    MAPriceDeviationThresholdExceeded = 0x3180,
187    /// 12673 - Invalid jupiter route data
188    #[error("Invalid jupiter route data")]
189    InvalidJupiterRoute = 0x3181,
190    /// 12674 - Insufficient swap output amount
191    #[error("Insufficient swap output amount")]
192    InsufficientSwapOutputAmount = 0x3182,
193    /// 12675 - Incorrect swap input amount
194    #[error("Incorrect swap input amount")]
195    IncorrectSwapInputAmount = 0x3183,
196    /// 12676 - Incorrect swap output amount
197    #[error("Incorrect swap output amount")]
198    IncorrectSwapOutputAmount = 0x3184,
199    /// 12677 - Account is not initialized
200    #[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