meteora_pools_sdk/errors/
amm.rs1use num_derive::FromPrimitive;
9use thiserror::Error;
10
11#[derive(Clone, Debug, Eq, Error, FromPrimitive, PartialEq)]
12pub enum AmmError {
13 #[error("Math operation overflow")]
15 MathOverflow = 0x1770,
16 #[error("Invalid fee setup")]
18 InvalidFee = 0x1771,
19 #[error("Invalid invariant d")]
21 InvalidInvariant = 0x1772,
22 #[error("Fee calculation failure")]
24 FeeCalculationFailure = 0x1773,
25 #[error("Exceeded slippage tolerance")]
27 ExceededSlippage = 0x1774,
28 #[error("Invalid curve calculation")]
30 InvalidCalculation = 0x1775,
31 #[error("Given pool token amount results in zero trading tokens")]
33 ZeroTradingTokens = 0x1776,
34 #[error("Math conversion overflow")]
36 ConversionError = 0x1777,
37 #[error("LP mint authority must be 'A' vault lp, without freeze authority, and 0 supply")]
39 FaultyLpMint = 0x1778,
40 #[error("Token mint mismatched")]
42 MismatchedTokenMint = 0x1779,
43 #[error("LP mint mismatched")]
45 MismatchedLpMint = 0x177A,
46 #[error("Invalid lp token owner")]
48 MismatchedOwner = 0x177B,
49 #[error("Invalid vault account")]
51 InvalidVaultAccount = 0x177C,
52 #[error("Invalid vault lp account")]
54 InvalidVaultLpAccount = 0x177D,
55 #[error("Invalid pool lp mint account")]
57 InvalidPoolLpMintAccount = 0x177E,
58 #[error("Pool disabled")]
60 PoolDisabled = 0x177F,
61 #[error("Invalid admin account")]
63 InvalidAdminAccount = 0x1780,
64 #[error("Invalid protocol fee account")]
66 InvalidProtocolFeeAccount = 0x1781,
67 #[error("Same admin account")]
69 SameAdminAccount = 0x1782,
70 #[error("Identical user source and destination token account")]
72 IdenticalSourceDestination = 0x1783,
73 #[error("Apy calculation error")]
75 ApyCalculationError = 0x1784,
76 #[error("Insufficient virtual price snapshot")]
78 InsufficientSnapshot = 0x1785,
79 #[error("Current curve is non-updatable")]
81 NonUpdatableCurve = 0x1786,
82 #[error("New curve is mismatched with old curve")]
84 MisMatchedCurve = 0x1787,
85 #[error("Amplification is invalid")]
87 InvalidAmplification = 0x1788,
88 #[error("Operation is not supported")]
90 UnsupportedOperation = 0x1789,
91 #[error("Exceed max amplification changes")]
93 ExceedMaxAChanges = 0x178A,
94 #[error("Invalid remaining accounts length")]
96 InvalidRemainingAccountsLen = 0x178B,
97 #[error("Invalid remaining account")]
99 InvalidRemainingAccounts = 0x178C,
100 #[error("Token mint B doesn't matches depeg type token mint")]
102 MismatchedDepegMint = 0x178D,
103 #[error("Invalid APY account")]
105 InvalidApyAccount = 0x178E,
106 #[error("Invalid token multiplier")]
108 InvalidTokenMultiplier = 0x178F,
109 #[error("Invalid depeg information")]
111 InvalidDepegInformation = 0x1790,
112 #[error("Update time constraint violated")]
114 UpdateTimeConstraint = 0x1791,
115 #[error("Exceeded max fee bps")]
117 ExceedMaxFeeBps = 0x1792,
118 #[error("Invalid admin")]
120 InvalidAdmin = 0x1793,
121 #[error("Pool is not permissioned")]
123 PoolIsNotPermissioned = 0x1794,
124 #[error("Invalid deposit amount")]
126 InvalidDepositAmount = 0x1795,
127 #[error("Invalid fee owner")]
129 InvalidFeeOwner = 0x1796,
130 #[error("Pool is not depleted")]
132 NonDepletedPool = 0x1797,
133 #[error("Token amount is not 1:1")]
135 AmountNotPeg = 0x1798,
136 #[error("Amount is zero")]
138 AmountIsZero = 0x1799,
139 #[error("Type cast error")]
141 TypeCastFailed = 0x179A,
142 #[error("Amount is not enough")]
144 AmountIsNotEnough = 0x179B,
145 #[error("Invalid activation duration")]
147 InvalidActivationDuration = 0x179C,
148 #[error("Pool is not launch pool")]
150 PoolIsNotLaunchPool = 0x179D,
151 #[error("Unable to modify activation point")]
153 UnableToModifyActivationPoint = 0x179E,
154 #[error("Invalid authority to create the pool")]
156 InvalidAuthorityToCreateThePool = 0x179F,
157 #[error("Invalid activation type")]
159 InvalidActivationType = 0x17A0,
160 #[error("Invalid activation point")]
162 InvalidActivationPoint = 0x17A1,
163 #[error("Pre activation swap window started")]
165 PreActivationSwapStarted = 0x17A2,
166 #[error("Invalid pool type")]
168 InvalidPoolType = 0x17A3,
169 #[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}