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    /// 6000 - Amount slippage exceeded
14    #[error("Amount slippage exceeded")]
15    AmountSlippageExceeded = 0x1770,
16    /// 6001 - Bad debt is not allowed for the executed instruction
17    #[error("Bad debt is not allowed for the executed instruction")]
18    BadDebt = 0x1771,
19    /// 6002 - Invalid number of remaining accounts
20    #[error("Invalid number of remaining accounts")]
21    InvalidRemainingAccountsLength = 0x1772,
22    /// 6003 - Invalid account owner
23    #[error("Invalid account owner")]
24    InvalidAccountOwner = 0x1773,
25    /// 6004 - Invalid instruction arguments
26    #[error("Invalid instruction arguments")]
27    InvalidInstructionArguments = 0x1774,
28    /// 6005 - Invalid market maker
29    #[error("Invalid market maker")]
30    InvalidMarketMaker = 0x1775,
31    /// 6006 - Provided SqrtPriceLimit not in the same direction as the swap.
32    #[error("Provided SqrtPriceLimit not in the same direction as the swap.")]
33    InvalidSqrtPriceLimitDirection = 0x1776,
34    /// 6007 - Invalid tick array sequence provided for instruction
35    #[error("Invalid tick array sequence provided for instruction")]
36    InvalidTickArraySequence = 0x1777,
37    /// 6008 - Insufficient liquidity
38    #[error("Insufficient liquidity")]
39    InsufficientLiquidity = 0x1778,
40    /// 6009 - Interest rate is out of range
41    #[error("Interest rate is out of range")]
42    InterestRateIsOutOfRange = 0x1779,
43    /// 6010 - Leverage is out or range
44    #[error("Leverage is out or range")]
45    LeverageIsOutOfRange = 0x177A,
46    /// 6011 - Leftovers percentage exceeded the maximum allowed value
47    #[error("Leftovers percentage exceeded the maximum allowed value")]
48    LeftoversExceeded = 0x177B,
49    /// 6012 - Limit order execution fee is out of range
50    #[error("Limit order execution fee is out of range")]
51    LimitOrderExecutionFeeIsOutOfRange = 0x177C,
52    /// 6013 - Liquidation fee is out of range
53    #[error("Liquidation fee is out of range")]
54    LiquidationFeeIsOutOfRange = 0x177D,
55    /// 6014 - Liquidation threshold is out of range
56    #[error("Liquidation threshold is out of range")]
57    LiquidationThresholdIsOutOfRange = 0x177E,
58    /// 6015 - Liquidity amount must be greater than zero.
59    #[error("Liquidity amount must be greater than zero.")]
60    LiquidityZero = 0x177F,
61    /// 6016 - Market is disabled
62    #[error("Market is disabled")]
63    MarketDisabled = 0x1780,
64    /// 6017 - Exceed the maximum allowed debt for the market
65    #[error("Exceed the maximum allowed debt for the market")]
66    MarketDebtLimitExceeded = 0x1781,
67    /// 6018 - Math overflow
68    #[error("Math overflow")]
69    MathOverflow = 0x1782,
70    /// 6019 - Math underflow
71    #[error("Math underflow")]
72    MathUnderflow = 0x1783,
73    /// 6020 - Unable to call transfer hook without extra accounts
74    #[error("Unable to call transfer hook without extra accounts")]
75    NoExtraAccountsForTransferHook = 0x1784,
76    /// 6021 - Oracle price is stale
77    #[error("Oracle price is stale")]
78    OracleStalePrice = 0x1785,
79    /// 6022 - OraclePriceDeviationThresholdExceeded
80    #[error("OraclePriceDeviationThresholdExceeded")]
81    OraclePriceDeviationThresholdExceeded = 0x1786,
82    /// 6023 - OraclePriceDeviationThresholdOutOfRange
83    #[error("OraclePriceDeviationThresholdOutOfRange")]
84    OraclePriceDeviationThresholdOutOfRange = 0x1787,
85    /// 6024 - Trade resulted in partial fill
86    #[error("Trade resulted in partial fill")]
87    PartialFillError = 0x1788,
88    /// 6025 - Position is healthy
89    #[error("Position is healthy")]
90    PositionIsHealthy = 0x1789,
91    /// 6026 - Position is already liquidated
92    #[error("Position is already liquidated")]
93    PositionIsLiquidated = 0x178A,
94    /// 6027 - Position is unhealthy
95    #[error("Position is unhealthy")]
96    PositionIsUnhealthy = 0x178B,
97    /// 6028 - Position is not empty
98    #[error("Position is not empty")]
99    PositionNotEmpty = 0x178C,
100    /// 6029 - Protocol fee is out of range
101    #[error("Protocol fee is out of range")]
102    ProtocolFeeIsOutOfRange = 0x178D,
103    /// 6030 - Rebalance conditions are not met
104    #[error("Rebalance conditions are not met")]
105    RebalanceConditionsNotMet = 0x178E,
106    /// 6031 - Same accounts type is provided more than once
107    #[error("Same accounts type is provided more than once")]
108    RemainingAccountsDuplicatedAccountsType = 0x178F,
109    /// 6032 - Invalid remaining accounts
110    #[error("Invalid remaining accounts")]
111    RemainingAccountsInvalidSlice = 0x1790,
112    /// 6033 - Invalid remaining accounts slice length
113    #[error("Invalid remaining accounts slice length")]
114    RemainingAccountsInvalidSliceLength = 0x1791,
115    /// 6034 - Insufficient remaining accounts
116    #[error("Insufficient remaining accounts")]
117    RemainingAccountsInsufficient = 0x1792,
118    /// 6035 - Required remaining account is not provided
119    #[error("Required remaining account is not provided")]
120    RequiredRemainingAccountNotProvided = 0x1793,
121    /// 6036 - Swap equation solver failed to t find the root
122    #[error("Swap equation solver failed to t find the root")]
123    SolverFailedToFindRoot = 0x1794,
124    /// 6037 - Provided sqrt price out of bounds
125    #[error("Provided sqrt price out of bounds")]
126    SqrtPriceOutOfBounds = 0x1795,
127    /// 6038 - Lending vault supply limit exceeded
128    #[error("Lending vault supply limit exceeded")]
129    SupplyLimitExceeded = 0x1796,
130    /// 6039 - Instruction is suspended
131    #[error("Instruction is suspended")]
132    Suspended = 0x1797,
133    /// 6040 - Maximum allowed swap slippage is exceeded
134    #[error("Maximum allowed swap slippage is exceeded")]
135    SwapSlippageExceeded = 0x1798,
136    /// 6041 - Provided swap slippage value is out of range
137    #[error("Provided swap slippage value is out of range")]
138    SwapSlippageIsOutOfRange = 0x1799,
139    /// 6042 - Swap to position ratio estimation failed
140    #[error("Swap to position ratio estimation failed")]
141    SwapToPositionRatioEstimationFailed = 0x179A,
142    /// 6043 - Swap quote amount is not equal to the actual swap amount
143    #[error("Swap quote amount is not equal to the actual swap amount")]
144    SwapQuoteNotEqualToActualSwapAmount = 0x179B,
145    /// 6044 - Tick index is out of bounds
146    #[error("Tick index is out of bounds")]
147    TickIndexOfBounds = 0x179C,
148    /// 6045 - Transfer fee calculation failed
149    #[error("Transfer fee calculation failed")]
150    TransferFeeCalculationError = 0x179D,
151    /// 6046 - Type cast overflow
152    #[error("Type cast overflow")]
153    TypeCastOverflow = 0x179E,
154    /// 6047 - Unable to load the account data
155    #[error("Unable to load the account data")]
156    UnableToLoadAccountData = 0x179F,
157    /// 6048 - Unable to deserialize the account data
158    #[error("Unable to deserialize the account data")]
159    UnableToDeserializeAccountData = 0x17A0,
160    /// 6049 - Unexpected value
161    #[error("Unexpected value")]
162    UnexpectedValue = 0x17A1,
163    /// 6050 - Token mint has unsupported attributes
164    #[error("Token mint has unsupported attributes")]
165    UnsupportedTokenMint = 0x17A2,
166    /// 6051 - Lending vault is not initialized
167    #[error("Lending vault is not initialized")]
168    VaultNotInitialized = 0x17A3,
169    /// 6052 - Withdraw request the exceeds user balance
170    #[error("Withdraw request the exceeds user balance")]
171    WithdrawRequestExceedsUserBalance = 0x17A4,
172    /// 6053 - Zero price range: the lower price is equal to upper price)
173    #[error("Zero price range: the lower price is equal to upper price)")]
174    ZeroPriceRange = 0x17A5,
175    /// 6054 - There are no tradable amount to swap.
176    #[error("There are no tradable amount to swap.")]
177    ZeroTradableAmount = 0x17A6,
178    /// 6055 - Collected yield is zero
179    #[error("Collected yield is zero")]
180    ZeroYield = 0x17A7,
181    /// 6056 - RaydiumInvalidFirstTickArrayAccount
182    #[error("RaydiumInvalidFirstTickArrayAccount")]
183    RaydiumInvalidFirstTickArrayAccount = 0x17A8,
184    /// 6057 - RaydiumInvalidTickArray
185    #[error("RaydiumInvalidTickArray")]
186    RaydiumInvalidTickArray = 0x17A9,
187    /// 6058 - RaydiumInvaildTickIndex
188    #[error("RaydiumInvaildTickIndex")]
189    RaydiumInvaildTickIndex = 0x17AA,
190    /// 6059 - RaydiumMaxTokenOverflow
191    #[error("RaydiumMaxTokenOverflow")]
192    RaydiumMaxTokenOverflow = 0x17AB,
193    /// 6060 - RaydiumNotEnoughTickArrayAccount
194    #[error("RaydiumNotEnoughTickArrayAccount")]
195    RaydiumNotEnoughTickArrayAccount = 0x17AC,
196    /// 6061 - RaydiumSqrtPriceLimitOverflow
197    #[error("RaydiumSqrtPriceLimitOverflow")]
198    RaydiumSqrtPriceLimitOverflow = 0x17AD,
199    /// 6062 - RaydiumZeroAmountSpecified
200    #[error("RaydiumZeroAmountSpecified")]
201    RaydiumZeroAmountSpecified = 0x17AE,
202}
203
204impl solana_program::program_error::PrintProgramError for TunaError {
205    fn print<E>(&self) {
206        solana_program::msg!(&self.to_string());
207    }
208}
209
210impl<T> solana_program::decode_error::DecodeError<T> for TunaError {
211    fn type_of() -> &'static str {
212        "TunaError"
213    }
214}
215