Skip to main content

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    /// 6499 - Enum value could not be converted
14    #[error("Enum value could not be converted")]
15    InvalidEnum = 0x1963,
16    /// 6500 - Type cast overflow
17    #[error("Type cast overflow")]
18    TypeCastOverflow = 0x1964,
19    /// 6501 - Math overflow
20    #[error("Math overflow")]
21    MathOverflow = 0x1965,
22    /// 6502 - Math underflow
23    #[error("Math underflow")]
24    MathUnderflow = 0x1966,
25    /// 6559 - Lending vault is not initialized
26    #[error("Lending vault is not initialized")]
27    VaultNotInitialized = 0x199F,
28    /// 6560 - Withdraw request the exceeds user balance
29    #[error("Withdraw request the exceeds user balance")]
30    WithdrawRequestExceedsUserBalance = 0x19A0,
31    /// 6561 - Zero price range: the lower price is equal to upper price)
32    #[error("Zero price range: the lower price is equal to upper price)")]
33    ZeroPriceRange = 0x19A1,
34    /// 6600 - Amount slippage exceeded
35    #[error("Amount slippage exceeded")]
36    AmountSlippageExceeded = 0x19C8,
37    /// 6601 - Bad debt is not allowed for the executed instruction
38    #[error("Bad debt is not allowed for the executed instruction")]
39    BadDebt = 0x19C9,
40    /// 6602 - Invalid number of remaining accounts
41    #[error("Invalid number of remaining accounts")]
42    InvalidRemainingAccountsLength = 0x19CA,
43    /// 6603 - Invalid instruction arguments
44    #[error("Invalid instruction arguments")]
45    InvalidInstructionArguments = 0x19CB,
46    /// 6604 - Invalid market maker
47    #[error("Invalid market maker")]
48    InvalidMarketMaker = 0x19CC,
49    /// 6605 - Invalid account discriminator
50    #[error("Invalid account discriminator")]
51    InvalidAccountDiscriminator = 0x19CD,
52    /// 6606 - Invalid account owner
53    #[error("Invalid account owner")]
54    InvalidAccountOwner = 0x19CE,
55    /// 6607 - Invalid Fusion or Orca pool
56    #[error("Invalid Fusion or Orca pool")]
57    InvalidPool = 0x19CF,
58    /// 6608 - Vault address is invalid
59    #[error("Vault address is invalid")]
60    InvalidVault = 0x19D0,
61    /// 6609 - Insufficient liquidity
62    #[error("Insufficient liquidity")]
63    InsufficientLiquidity = 0x19D1,
64    /// 6610 - Interest rate is out of range
65    #[error("Interest rate is out of range")]
66    InterestRateIsOutOfRange = 0x19D2,
67    /// 6611 - Leverage is out or range
68    #[error("Leverage is out or range")]
69    LeverageIsOutOfRange = 0x19D3,
70    /// 6612 - Leftovers percentage exceeded the maximum allowed value
71    #[error("Leftovers percentage exceeded the maximum allowed value")]
72    LeftoversExceeded = 0x19D4,
73    /// 6613 - Liquidation fee is out of range
74    #[error("Liquidation fee is out of range")]
75    LiquidationFeeIsOutOfRange = 0x19D5,
76    /// 6614 - Liquidation threshold is out of range
77    #[error("Liquidation threshold is out of range")]
78    LiquidationThresholdIsOutOfRange = 0x19D6,
79    /// 6615 - Market is disabled
80    #[error("Market is disabled")]
81    MarketDisabled = 0x19D7,
82    /// 6616 - Exceed the maximum allowed debt for the market
83    #[error("Exceed the maximum allowed debt for the market")]
84    MarketDebtLimitExceeded = 0x19D8,
85    /// 6617 - Unable to call transfer hook without extra accounts
86    #[error("Unable to call transfer hook without extra accounts")]
87    NoExtraAccountsForTransferHook = 0x19D9,
88    /// 6618 - Oracle price is stale
89    #[error("Oracle price is stale")]
90    OracleStalePrice = 0x19DA,
91    /// 6619 - Oracle price deviation threshold exceeded
92    #[error("Oracle price deviation threshold exceeded")]
93    OraclePriceDeviationThresholdExceeded = 0x19DB,
94    /// 6620 - Oracle price deviation threshold out of range
95    #[error("Oracle price deviation threshold out of range")]
96    OraclePriceDeviationThresholdOutOfRange = 0x19DC,
97    /// 6621 - Invalid oracle price update account
98    #[error("Invalid oracle price update account")]
99    InvalidPriceUpdateAccount = 0x19DD,
100    /// 6622 - Position is healthy
101    #[error("Position is healthy")]
102    PositionIsHealthy = 0x19DE,
103    /// 6623 - Position is already liquidated
104    #[error("Position is already liquidated")]
105    PositionIsLiquidated = 0x19DF,
106    /// 6624 - Position is unhealthy
107    #[error("Position is unhealthy")]
108    PositionIsUnhealthy = 0x19E0,
109    /// 6625 - Position is not empty
110    #[error("Position is not empty")]
111    PositionNotEmpty = 0x19E1,
112    /// 6626 - Position is empty
113    #[error("Position is empty")]
114    PositionIsEmpty = 0x19E2,
115    /// 6627 - Unable to claim yield for auto re-balanceable positions
116    #[error("Unable to claim yield for auto re-balanceable positions")]
117    PositionIsAutoRebalanceable = 0x19E3,
118    /// 6628 - Position size exceeds the maximum allowed value
119    #[error("Position size exceeds the maximum allowed value")]
120    PositionSizeLimitExceeded = 0x19E4,
121    /// 6640 - Protocol fee is out of range
122    #[error("Protocol fee is out of range")]
123    ProtocolFeeIsOutOfRange = 0x19F0,
124    /// 6641 - Rebalance conditions are not met
125    #[error("Rebalance conditions are not met")]
126    RebalanceConditionsNotMet = 0x19F1,
127    /// 6642 - Same accounts type is provided more than once
128    #[error("Same accounts type is provided more than once")]
129    RemainingAccountsDuplicatedAccountsType = 0x19F2,
130    /// 6643 - Invalid remaining accounts
131    #[error("Invalid remaining accounts")]
132    RemainingAccountsInvalidSlice = 0x19F3,
133    /// 6644 - Invalid remaining accounts slice length
134    #[error("Invalid remaining accounts slice length")]
135    RemainingAccountsInvalidSliceLength = 0x19F4,
136    /// 6645 - Insufficient remaining accounts
137    #[error("Insufficient remaining accounts")]
138    RemainingAccountsInsufficient = 0x19F5,
139    /// 6646 - Required remaining account is not provided
140    #[error("Required remaining account is not provided")]
141    RequiredRemainingAccountNotProvided = 0x19F6,
142    /// 6647 - Swap equation solver failed to t find the root
143    #[error("Swap equation solver failed to t find the root")]
144    SolverFailedToFindRoot = 0x19F7,
145    /// 6648 - Lending vault supply limit exceeded
146    #[error("Lending vault supply limit exceeded")]
147    SupplyLimitExceeded = 0x19F8,
148    /// 6649 - Instruction is suspended
149    #[error("Instruction is suspended")]
150    Suspended = 0x19F9,
151    /// 6650 - Maximum allowed swap slippage is exceeded
152    #[error("Maximum allowed swap slippage is exceeded")]
153    SwapSlippageExceeded = 0x19FA,
154    /// 6651 - Provided swap slippage value is out of range
155    #[error("Provided swap slippage value is out of range")]
156    SwapSlippageIsOutOfRange = 0x19FB,
157    /// 6652 - Swap to position ratio estimation failed
158    #[error("Swap to position ratio estimation failed")]
159    SwapToPositionRatioEstimationFailed = 0x19FC,
160    /// 6653 - Swap quote amount is not equal to the actual swap amount
161    #[error("Swap quote amount is not equal to the actual swap amount")]
162    SwapQuoteNotEqualToActualSwapAmount = 0x19FD,
163    /// 6654 - Transfer fee calculation failed
164    #[error("Transfer fee calculation failed")]
165    TransferFeeCalculationError = 0x19FE,
166    /// 6655 - Unable to load the account data
167    #[error("Unable to load the account data")]
168    UnableToLoadAccountData = 0x19FF,
169    /// 6656 - Unable to deserialize the account data
170    #[error("Unable to deserialize the account data")]
171    UnableToDeserializeAccountData = 0x1A00,
172    /// 6657 - Unexpected value
173    #[error("Unexpected value")]
174    UnexpectedValue = 0x1A01,
175    /// 6658 - Token mint has unsupported attributes
176    #[error("Token mint has unsupported attributes")]
177    UnsupportedTokenMint = 0x1A02,
178    /// 6662 - Collected yield is zero
179    #[error("Collected yield is zero")]
180    ZeroYield = 0x1A06,
181    /// 6664 - Zero bad debt
182    #[error("Zero bad debt")]
183    ZeroBadDebt = 0x1A08,
184    /// 6670 - Incorrect position direction
185    #[error("Incorrect position direction")]
186    IncorrectPositionDirection = 0x1A0E,
187    /// 6671 - Optional recipient account is not set
188    #[error("Optional recipient account is not set")]
189    RecipientAccountIsNotSet = 0x1A0F,
190    /// 6672 - Moving Average price deviation threshold exceeded
191    #[error("Moving Average price deviation threshold exceeded")]
192    MAPriceDeviationThresholdExceeded = 0x1A10,
193    /// 6673 - Account is not initialized
194    #[error("Account is not initialized")]
195    AccountNotInitialized = 0x1A11,
196    /// 6674 - Position is locked
197    #[error("Position is locked")]
198    PositionLocked = 0x1A12,
199    /// 6675 - Leveraged locked position is not allowed
200    #[error("Leveraged locked position is not allowed")]
201    LeveragedLockedPositionNotAllowed = 0x1A13,
202    /// 6700 - Invalid jupiter create token account instruction data
203    #[error("Invalid jupiter create token account instruction data")]
204    InvalidJupiterCreateTokenAccountInstructionData = 0x1A2C,
205    /// 6701 - Invalid jupiter create token account instruction user account
206    #[error("Invalid jupiter create token account instruction user account")]
207    InvalidJupiterCreateTokenAccountUserAccount = 0x1A2D,
208    /// 6702 - Invalid jupiter route instruction data
209    #[error("Invalid jupiter route instruction data")]
210    InvalidJupiterRouteInstructionData = 0x1A2E,
211    /// 6703 - Invalid jupiter route instruction
212    #[error("Invalid jupiter route instruction")]
213    InvalidJupiterRouteInstructionAccount = 0x1A2F,
214    /// 6704 - Insufficient swap output amount
215    #[error("Insufficient swap output amount")]
216    InsufficientJupiterSwapOutputAmount = 0x1A30,
217    /// 6705 - Incorrect swap input amount
218    #[error("Incorrect swap input amount")]
219    IncorrectJupiterSwapInputAmount = 0x1A31,
220}
221
222impl From<TunaError> for solana_program_error::ProgramError {
223    fn from(e: TunaError) -> Self {
224        solana_program_error::ProgramError::Custom(e as u32)
225    }
226}
227