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 - AmountSlippageExceeded
14    #[error("AmountSlippageExceeded")]
15    AmountSlippageExceeded = 0x1770,
16    /// 6001 - BadDebt
17    #[error("BadDebt")]
18    BadDebt = 0x1771,
19    /// 6002 - InvalidRemainingAccountsLength
20    #[error("InvalidRemainingAccountsLength")]
21    InvalidRemainingAccountsLength = 0x1772,
22    /// 6003 - InvalidAccounts
23    #[error("InvalidAccounts")]
24    InvalidTickArrayAccounts = 0x1773,
25    /// 6004 - InvalidAccountOwner
26    #[error("InvalidAccountOwner")]
27    InvalidAccountOwner = 0x1774,
28    /// 6005 - InvalidInstructionArguments
29    #[error("InvalidInstructionArguments")]
30    InvalidInstructionArguments = 0x1775,
31    /// 6006 - InvalidMarketMaker
32    #[error("InvalidMarketMaker")]
33    InvalidMarketMaker = 0x1776,
34    /// 6007 - Provided SqrtPriceLimit not in the same direction as the swap.
35    #[error("Provided SqrtPriceLimit not in the same direction as the swap.")]
36    InvalidSqrtPriceLimitDirection = 0x1777,
37    /// 6008 - InvalidTickArraySequence
38    #[error("InvalidTickArraySequence")]
39    InvalidTickArraySequence = 0x1778,
40    /// 6009 - InsufficientLiquidity
41    #[error("InsufficientLiquidity")]
42    InsufficientLiquidity = 0x1779,
43    /// 6010 - InterestRateIsOutOfRange
44    #[error("InterestRateIsOutOfRange")]
45    InterestRateIsOutOfRange = 0x177A,
46    /// 6011 - LeverageIsOutOfRange
47    #[error("LeverageIsOutOfRange")]
48    LeverageIsOutOfRange = 0x177B,
49    /// 6012 - LeftoversExceeded
50    #[error("LeftoversExceeded")]
51    LeftoversExceeded = 0x177C,
52    /// 6013 - LimitOrderExecutionFeeIsOutOfRange
53    #[error("LimitOrderExecutionFeeIsOutOfRange")]
54    LimitOrderExecutionFeeIsOutOfRange = 0x177D,
55    /// 6014 - LiquidationFeeIsOutOfRange
56    #[error("LiquidationFeeIsOutOfRange")]
57    LiquidationFeeIsOutOfRange = 0x177E,
58    /// 6015 - LiquidationThresholdIsOutOfRange
59    #[error("LiquidationThresholdIsOutOfRange")]
60    LiquidationThresholdIsOutOfRange = 0x177F,
61    /// 6016 - Liquidity amount must be greater than zero.
62    #[error("Liquidity amount must be greater than zero.")]
63    LiquidityZero = 0x1780,
64    /// 6017 - MarketDisabled
65    #[error("MarketDisabled")]
66    MarketDisabled = 0x1781,
67    /// 6018 - MarketDebtLimitExceeded
68    #[error("MarketDebtLimitExceeded")]
69    MarketDebtLimitExceeded = 0x1782,
70    /// 6019 - MathOverflow
71    #[error("MathOverflow")]
72    MathOverflow = 0x1783,
73    /// 6020 - MathUnderflow
74    #[error("MathUnderflow")]
75    MathUnderflow = 0x1784,
76    /// 6021 - Unable to call transfer hook without extra accounts
77    #[error("Unable to call transfer hook without extra accounts")]
78    NoExtraAccountsForTransferHook = 0x1785,
79    /// 6022 - OracleStalePrice
80    #[error("OracleStalePrice")]
81    OracleStalePrice = 0x1786,
82    /// 6023 - OraclePriceDeviationThresholdExceeded
83    #[error("OraclePriceDeviationThresholdExceeded")]
84    OraclePriceDeviationThresholdExceeded = 0x1787,
85    /// 6024 - OraclePriceDeviationThresholdOutOfRange
86    #[error("OraclePriceDeviationThresholdOutOfRange")]
87    OraclePriceDeviationThresholdOutOfRange = 0x1788,
88    /// 6025 - Trade resulted in partial fill
89    #[error("Trade resulted in partial fill")]
90    PartialFillError = 0x1789,
91    /// 6026 - PositionIsHealthy
92    #[error("PositionIsHealthy")]
93    PositionIsHealthy = 0x178A,
94    /// 6027 - PositionIsLiquidated
95    #[error("PositionIsLiquidated")]
96    PositionIsLiquidated = 0x178B,
97    /// 6028 - PositionIsUnhealthy
98    #[error("PositionIsUnhealthy")]
99    PositionIsUnhealthy = 0x178C,
100    /// 6029 - PositionNotEmpty
101    #[error("PositionNotEmpty")]
102    PositionNotEmpty = 0x178D,
103    /// 6030 - ProtocolFeeIsOutOfRange
104    #[error("ProtocolFeeIsOutOfRange")]
105    ProtocolFeeIsOutOfRange = 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 - SolverFailedToFindRoot
122    #[error("SolverFailedToFindRoot")]
123    SolverFailedToFindRoot = 0x1794,
124    /// 6037 - SqrtPriceOutOfBounds
125    #[error("SqrtPriceOutOfBounds")]
126    SqrtPriceOutOfBounds = 0x1795,
127    /// 6038 - SupplyLimitExceeded
128    #[error("SupplyLimitExceeded")]
129    SupplyLimitExceeded = 0x1796,
130    /// 6039 - Suspended
131    #[error("Suspended")]
132    Suspended = 0x1797,
133    /// 6040 - SwapSlippageExceeded
134    #[error("SwapSlippageExceeded")]
135    SwapSlippageExceeded = 0x1798,
136    /// 6041 - SwapSlippageIsOutOfRange
137    #[error("SwapSlippageIsOutOfRange")]
138    SwapSlippageIsOutOfRange = 0x1799,
139    /// 6042 - TickIndexOfBounds
140    #[error("TickIndexOfBounds")]
141    TickIndexOfBounds = 0x179A,
142    /// 6043 - Transfer fee calculation failed
143    #[error("Transfer fee calculation failed")]
144    TransferFeeCalculationError = 0x179B,
145    /// 6044 - TypeCastOverflow
146    #[error("TypeCastOverflow")]
147    TypeCastOverflow = 0x179C,
148    /// 6045 - UnexpectedValue
149    #[error("UnexpectedValue")]
150    UnexpectedValue = 0x179D,
151    /// 6046 - Token mint has unsupported attributes
152    #[error("Token mint has unsupported attributes")]
153    UnsupportedTokenMint = 0x179E,
154    /// 6047 - VaultNotInitialized
155    #[error("VaultNotInitialized")]
156    VaultNotInitialized = 0x179F,
157    /// 6048 - WithdrawRequestExceedsUserBalance
158    #[error("WithdrawRequestExceedsUserBalance")]
159    WithdrawRequestExceedsUserBalance = 0x17A0,
160    /// 6049 - ZeroPriceRange
161    #[error("ZeroPriceRange")]
162    ZeroPriceRange = 0x17A1,
163    /// 6050 - There are no tradable amount to swap.
164    #[error("There are no tradable amount to swap.")]
165    ZeroTradableAmount = 0x17A2,
166    /// 6051 - ZeroYield
167    #[error("ZeroYield")]
168    ZeroYield = 0x17A3,
169    /// 6052 - RaydiumInvalidFirstTickArrayAccount
170    #[error("RaydiumInvalidFirstTickArrayAccount")]
171    RaydiumInvalidFirstTickArrayAccount = 0x17A4,
172    /// 6053 - RaydiumInvalidTickArray
173    #[error("RaydiumInvalidTickArray")]
174    RaydiumInvalidTickArray = 0x17A5,
175    /// 6054 - RaydiumInvaildTickIndex
176    #[error("RaydiumInvaildTickIndex")]
177    RaydiumInvaildTickIndex = 0x17A6,
178    /// 6055 - RaydiumMaxTokenOverflow
179    #[error("RaydiumMaxTokenOverflow")]
180    RaydiumMaxTokenOverflow = 0x17A7,
181    /// 6056 - RaydiumNotEnoughTickArrayAccount
182    #[error("RaydiumNotEnoughTickArrayAccount")]
183    RaydiumNotEnoughTickArrayAccount = 0x17A8,
184    /// 6057 - RaydiumSqrtPriceLimitOverflow
185    #[error("RaydiumSqrtPriceLimitOverflow")]
186    RaydiumSqrtPriceLimitOverflow = 0x17A9,
187    /// 6058 - RaydiumZeroAmountSpecified
188    #[error("RaydiumZeroAmountSpecified")]
189    RaydiumZeroAmountSpecified = 0x17AA,
190    /// 6059 - UnableToLoadAccountData
191    #[error("UnableToLoadAccountData")]
192    UnableToLoadAccountData = 0x17AB,
193    /// 6060 - UnableToDeserializeAccountData
194    #[error("UnableToDeserializeAccountData")]
195    UnableToDeserializeAccountData = 0x17AC,
196}
197
198impl solana_program::program_error::PrintProgramError for TunaError {
199    fn print<E>(&self) {
200        solana_program::msg!(&self.to_string());
201    }
202}
203
204impl<T> solana_program::decode_error::DecodeError<T> for TunaError {
205    fn type_of() -> &'static str {
206        "TunaError"
207    }
208}
209