meteora_pools_sdk/errors/
amm.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 AmmError {
13    /// 6000 - Math operation overflow
14    #[error("Math operation overflow")]
15    MathOverflow = 0x1770,
16    /// 6001 - Invalid fee setup
17    #[error("Invalid fee setup")]
18    InvalidFee = 0x1771,
19    /// 6002 - Invalid invariant d
20    #[error("Invalid invariant d")]
21    InvalidInvariant = 0x1772,
22    /// 6003 - Fee calculation failure
23    #[error("Fee calculation failure")]
24    FeeCalculationFailure = 0x1773,
25    /// 6004 - Exceeded slippage tolerance
26    #[error("Exceeded slippage tolerance")]
27    ExceededSlippage = 0x1774,
28    /// 6005 - Invalid curve calculation
29    #[error("Invalid curve calculation")]
30    InvalidCalculation = 0x1775,
31    /// 6006 - Given pool token amount results in zero trading tokens
32    #[error("Given pool token amount results in zero trading tokens")]
33    ZeroTradingTokens = 0x1776,
34    /// 6007 - Math conversion overflow
35    #[error("Math conversion overflow")]
36    ConversionError = 0x1777,
37    /// 6008 - LP mint authority must be 'A' vault lp, without freeze authority, and 0 supply
38    #[error("LP mint authority must be 'A' vault lp, without freeze authority, and 0 supply")]
39    FaultyLpMint = 0x1778,
40    /// 6009 - Token mint mismatched
41    #[error("Token mint mismatched")]
42    MismatchedTokenMint = 0x1779,
43    /// 6010 - LP mint mismatched
44    #[error("LP mint mismatched")]
45    MismatchedLpMint = 0x177A,
46    /// 6011 - Invalid lp token owner
47    #[error("Invalid lp token owner")]
48    MismatchedOwner = 0x177B,
49    /// 6012 - Invalid vault account
50    #[error("Invalid vault account")]
51    InvalidVaultAccount = 0x177C,
52    /// 6013 - Invalid vault lp account
53    #[error("Invalid vault lp account")]
54    InvalidVaultLpAccount = 0x177D,
55    /// 6014 - Invalid pool lp mint account
56    #[error("Invalid pool lp mint account")]
57    InvalidPoolLpMintAccount = 0x177E,
58    /// 6015 - Pool disabled
59    #[error("Pool disabled")]
60    PoolDisabled = 0x177F,
61    /// 6016 - Invalid admin account
62    #[error("Invalid admin account")]
63    InvalidAdminAccount = 0x1780,
64    /// 6017 - Invalid protocol fee account
65    #[error("Invalid protocol fee account")]
66    InvalidProtocolFeeAccount = 0x1781,
67    /// 6018 - Same admin account
68    #[error("Same admin account")]
69    SameAdminAccount = 0x1782,
70    /// 6019 - Identical user source and destination token account
71    #[error("Identical user source and destination token account")]
72    IdenticalSourceDestination = 0x1783,
73    /// 6020 - Apy calculation error
74    #[error("Apy calculation error")]
75    ApyCalculationError = 0x1784,
76    /// 6021 - Insufficient virtual price snapshot
77    #[error("Insufficient virtual price snapshot")]
78    InsufficientSnapshot = 0x1785,
79    /// 6022 - Current curve is non-updatable
80    #[error("Current curve is non-updatable")]
81    NonUpdatableCurve = 0x1786,
82    /// 6023 - New curve is mismatched with old curve
83    #[error("New curve is mismatched with old curve")]
84    MisMatchedCurve = 0x1787,
85    /// 6024 - Amplification is invalid
86    #[error("Amplification is invalid")]
87    InvalidAmplification = 0x1788,
88    /// 6025 - Operation is not supported
89    #[error("Operation is not supported")]
90    UnsupportedOperation = 0x1789,
91    /// 6026 - Exceed max amplification changes
92    #[error("Exceed max amplification changes")]
93    ExceedMaxAChanges = 0x178A,
94    /// 6027 - Invalid remaining accounts length
95    #[error("Invalid remaining accounts length")]
96    InvalidRemainingAccountsLen = 0x178B,
97    /// 6028 - Invalid remaining account
98    #[error("Invalid remaining account")]
99    InvalidRemainingAccounts = 0x178C,
100    /// 6029 - Token mint B doesn't matches depeg type token mint
101    #[error("Token mint B doesn't matches depeg type token mint")]
102    MismatchedDepegMint = 0x178D,
103    /// 6030 - Invalid APY account
104    #[error("Invalid APY account")]
105    InvalidApyAccount = 0x178E,
106    /// 6031 - Invalid token multiplier
107    #[error("Invalid token multiplier")]
108    InvalidTokenMultiplier = 0x178F,
109    /// 6032 - Invalid depeg information
110    #[error("Invalid depeg information")]
111    InvalidDepegInformation = 0x1790,
112    /// 6033 - Update time constraint violated
113    #[error("Update time constraint violated")]
114    UpdateTimeConstraint = 0x1791,
115    /// 6034 - Exceeded max fee bps
116    #[error("Exceeded max fee bps")]
117    ExceedMaxFeeBps = 0x1792,
118    /// 6035 - Invalid admin
119    #[error("Invalid admin")]
120    InvalidAdmin = 0x1793,
121    /// 6036 - Pool is not permissioned
122    #[error("Pool is not permissioned")]
123    PoolIsNotPermissioned = 0x1794,
124    /// 6037 - Invalid deposit amount
125    #[error("Invalid deposit amount")]
126    InvalidDepositAmount = 0x1795,
127    /// 6038 - Invalid fee owner
128    #[error("Invalid fee owner")]
129    InvalidFeeOwner = 0x1796,
130    /// 6039 - Pool is not depleted
131    #[error("Pool is not depleted")]
132    NonDepletedPool = 0x1797,
133    /// 6040 - Token amount is not 1:1
134    #[error("Token amount is not 1:1")]
135    AmountNotPeg = 0x1798,
136    /// 6041 - Amount is zero
137    #[error("Amount is zero")]
138    AmountIsZero = 0x1799,
139    /// 6042 - Type cast error
140    #[error("Type cast error")]
141    TypeCastFailed = 0x179A,
142    /// 6043 - Amount is not enough
143    #[error("Amount is not enough")]
144    AmountIsNotEnough = 0x179B,
145    /// 6044 - Invalid activation duration
146    #[error("Invalid activation duration")]
147    InvalidActivationDuration = 0x179C,
148    /// 6045 - Pool is not launch pool
149    #[error("Pool is not launch pool")]
150    PoolIsNotLaunchPool = 0x179D,
151    /// 6046 - Unable to modify activation point
152    #[error("Unable to modify activation point")]
153    UnableToModifyActivationPoint = 0x179E,
154    /// 6047 - Invalid authority to create the pool
155    #[error("Invalid authority to create the pool")]
156    InvalidAuthorityToCreateThePool = 0x179F,
157    /// 6048 - Invalid activation type
158    #[error("Invalid activation type")]
159    InvalidActivationType = 0x17A0,
160    /// 6049 - Invalid activation point
161    #[error("Invalid activation point")]
162    InvalidActivationPoint = 0x17A1,
163    /// 6050 - Pre activation swap window started
164    #[error("Pre activation swap window started")]
165    PreActivationSwapStarted = 0x17A2,
166    /// 6051 - Invalid pool type
167    #[error("Invalid pool type")]
168    InvalidPoolType = 0x17A3,
169    /// 6052 - Quote token must be SOL,USDC
170    #[error("Quote token must be SOL,USDC")]
171    InvalidQuoteMint = 0x17A4,
172}
173
174impl solana_program::program_error::PrintProgramError for AmmError {
175    fn print<E>(&self) {
176        solana_program::msg!(&self.to_string());
177    }
178}
179
180impl<T> solana_program::decode_error::DecodeError<T> for AmmError {
181    fn type_of() -> &'static str {
182        "AmmError"
183    }
184}