Skip to main content

jup_perps_client/errors/
perpetuals.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 PerpetualsError {
13    /// 6000 - Overflow in arithmetic operation
14    #[error("Overflow in arithmetic operation")]
15    MathOverflow = 0x1770,
16    /// 6001 - Unsupported price oracle
17    #[error("Unsupported price oracle")]
18    UnsupportedOracle = 0x1771,
19    /// 6002 - Invalid oracle account
20    #[error("Invalid oracle account")]
21    InvalidOracleAccount = 0x1772,
22    /// 6003 - Stale oracle price
23    #[error("Stale oracle price")]
24    StaleOraclePrice = 0x1773,
25    /// 6004 - Invalid oracle price
26    #[error("Invalid oracle price")]
27    InvalidOraclePrice = 0x1774,
28    /// 6005 - Instruction is not allowed in production
29    #[error("Instruction is not allowed in production")]
30    InvalidEnvironment = 0x1775,
31    /// 6006 - Invalid collateral account
32    #[error("Invalid collateral account")]
33    InvalidCollateralAccount = 0x1776,
34    /// 6007 - Invalid collateral amount
35    #[error("Invalid collateral amount")]
36    InvalidCollateralAmount = 0x1777,
37    /// 6008 - Collateral slippage
38    #[error("Collateral slippage")]
39    CollateralSlippage = 0x1778,
40    /// 6009 - Invalid position state
41    #[error("Invalid position state")]
42    InvalidPositionState = 0x1779,
43    /// 6010 - Invalid perpetuals config
44    #[error("Invalid perpetuals config")]
45    InvalidPerpetualsConfig = 0x177A,
46    /// 6011 - Invalid pool config
47    #[error("Invalid pool config")]
48    InvalidPoolConfig = 0x177B,
49    /// 6012 - Invalid instruction
50    #[error("Invalid instruction")]
51    InvalidInstruction = 0x177C,
52    /// 6013 - Invalid custody config
53    #[error("Invalid custody config")]
54    InvalidCustodyConfig = 0x177D,
55    /// 6014 - Invalid custody balance
56    #[error("Invalid custody balance")]
57    InvalidCustodyBalance = 0x177E,
58    /// 6015 - Invalid argument
59    #[error("Invalid argument")]
60    InvalidArgument = 0x177F,
61    /// 6016 - Invalid position request
62    #[error("Invalid position request")]
63    InvalidPositionRequest = 0x1780,
64    /// 6017 - Invalid position request input ata
65    #[error("Invalid position request input ata")]
66    InvalidPositionRequestInputAta = 0x1781,
67    /// 6018 - Invalid mint
68    #[error("Invalid mint")]
69    InvalidMint = 0x1782,
70    /// 6019 - Insufficient token amount
71    #[error("Insufficient token amount")]
72    InsufficientTokenAmount = 0x1783,
73    /// 6020 - Insufficient token amount returned
74    #[error("Insufficient token amount returned")]
75    InsufficientAmountReturned = 0x1784,
76    /// 6021 - Price slippage limit exceeded
77    #[error("Price slippage limit exceeded")]
78    MaxPriceSlippage = 0x1785,
79    /// 6022 - Position leverage limit exceeded
80    #[error("Position leverage limit exceeded")]
81    MaxLeverage = 0x1786,
82    /// 6023 - Custody amount limit exceeded
83    #[error("Custody amount limit exceeded")]
84    CustodyAmountLimit = 0x1787,
85    /// 6024 - Pool amount limit exceeded
86    #[error("Pool amount limit exceeded")]
87    PoolAmountLimit = 0x1788,
88    /// 6025 - Personal pool amount limit exceeded
89    #[error("Personal pool amount limit exceeded")]
90    PersonalPoolAmountLimit = 0x1789,
91    /// 6026 - Token is not supported
92    #[error("Token is not supported")]
93    UnsupportedToken = 0x178A,
94    /// 6027 - Instruction is not allowed at this time
95    #[error("Instruction is not allowed at this time")]
96    InstructionNotAllowed = 0x178B,
97    /// 6028 - Jupiter Program ID mismatch
98    #[error("Jupiter Program ID mismatch")]
99    JupiterProgramMismatch = 0x178C,
100    /// 6029 - Program ID mismatch
101    #[error("Program ID mismatch")]
102    ProgramMismatch = 0x178D,
103    /// 6030 - Address mismatch
104    #[error("Address mismatch")]
105    AddressMismatch = 0x178E,
106    /// 6031 - Missing keeper ATA
107    #[error("Missing keeper ATA")]
108    KeeperATAMissing = 0x178F,
109    /// 6032 - Swap amount mismatch
110    #[error("Swap amount mismatch")]
111    SwapAmountMismatch = 0x1790,
112    /// 6033 - CPI not allowed
113    #[error("CPI not allowed")]
114    CPINotAllowed = 0x1791,
115    /// 6034 - Invalid Keeper
116    #[error("Invalid Keeper")]
117    InvalidKeeper = 0x1792,
118    /// 6035 - Exceed execution period
119    #[error("Exceed execution period")]
120    ExceedExecutionPeriod = 0x1793,
121    /// 6036 - Invalid Request Type
122    #[error("Invalid Request Type")]
123    InvalidRequestType = 0x1794,
124    /// 6037 - Invalid Trigger Price
125    #[error("Invalid Trigger Price")]
126    InvalidTriggerPrice = 0x1795,
127    /// 6038 - Trigger Price Slippage
128    #[error("Trigger Price Slippage")]
129    TriggerPriceSlippage = 0x1796,
130    /// 6039 - Missing Trigger Price
131    #[error("Missing Trigger Price")]
132    MissingTriggerPrice = 0x1797,
133    /// 6040 - Missing Price Slippage
134    #[error("Missing Price Slippage")]
135    MissingPriceSlippage = 0x1798,
136    /// 6041 - Invalid Price Calc Mode
137    #[error("Invalid Price Calc Mode")]
138    InvalidPriceCalcMode = 0x1799,
139    /// 6042 - Request Updated Too Recent
140    #[error("Request Updated Too Recent")]
141    RequestUpdatedTooRecent = 0x179A,
142    /// 6043 - Exceed Token Weightage
143    #[error("Exceed Token Weightage")]
144    ExceedTokenWeightage = 0x179B,
145    /// 6044 - Oracle Publish Time Too Early
146    #[error("Oracle Publish Time Too Early")]
147    OraclePublishTimeTooEarly = 0x179C,
148    /// 6045 - Pull Oracle Publish Time Too Early
149    #[error("Pull Oracle Publish Time Too Early")]
150    PullOraclePublishTimeTooEarly = 0x179D,
151    /// 6046 - Stale Pull Oracle Price
152    #[error("Stale Pull Oracle Price")]
153    StalePullOraclePrice = 0x179E,
154    /// 6047 - Invalid Pull Oracle Price
155    #[error("Invalid Pull Oracle Price")]
156    InvalidPullOraclePrice = 0x179F,
157    /// 6048 - Pull Oracle Not Verified
158    #[error("Pull Oracle Not Verified")]
159    PullOracleNotVerified = 0x17A0,
160    /// 6049 - Price Diff Between Pull and Push Oracle is Too Large
161    #[error("Price Diff Between Pull and Push Oracle is Too Large")]
162    PriceDiffTooLarge = 0x17A1,
163    /// 6050 - Invalid Doves Oracle Price
164    #[error("Invalid Doves Oracle Price")]
165    InvalidDovesOraclePrice = 0x17A2,
166    /// 6051 - Invalid Request Time
167    #[error("Invalid Request Time")]
168    InvalidRequestTime = 0x17A3,
169    /// 6052 - Position Updated Too Recent
170    #[error("Position Updated Too Recent")]
171    PositionUpdatedTooRecent = 0x17A4,
172    /// 6053 - Ledger token account does not match
173    #[error("Ledger token account does not match")]
174    LedgerTokenAccountDoesNotMatch = 0x17A5,
175    /// 6054 - Invalid token ledger
176    #[error("Invalid token ledger")]
177    InvalidTokenLedger = 0x17A6,
178    /// 6055 - Oracle Price Difference Too Large
179    #[error("Oracle Price Difference Too Large")]
180    OraclePriceDifferenceTooLarge = 0x17A7,
181    /// 6056 - Invalid Oracle Signer
182    #[error("Invalid Oracle Signer")]
183    InvalidOracleSigner = 0x17A8,
184    /// 6057 - Invalid Oracle Timestamp
185    #[error("Invalid Oracle Timestamp")]
186    InvalidOracleTimestamp = 0x17A9,
187    /// 6058 - New Max Global Long Size Too Low
188    #[error("New Max Global Long Size Too Low")]
189    InvalidMaxGlobalLongSize = 0x17AA,
190    /// 6059 - New Max Global Short Size Too Low
191    #[error("New Max Global Short Size Too Low")]
192    InvalidMaxGlobalShortSize = 0x17AB,
193    /// 6060 - Borrows disabled for this custody
194    #[error("Borrows disabled for this custody")]
195    BorrowsDisabled = 0x17AC,
196    /// 6061 - Borrows limit exceeded for this custody
197    #[error("Borrows limit exceeded for this custody")]
198    BorrowLimitsExceeded = 0x17AD,
199    /// 6062 - Withdraw exceeds margin of the custody
200    #[error("Withdraw exceeds margin of the custody")]
201    WithdrawExceedsMarginLimits = 0x17AE,
202    /// 6063 - Cannot liquidate
203    #[error("Cannot liquidate")]
204    CannotLiquidate = 0x17AF,
205    /// 6064 - Cannot delegate stake to deactivated account
206    #[error("Cannot delegate stake to deactivated account")]
207    CannotDelegateStake = 0x17B0,
208    /// 6065 - Max total staked amount exceeded
209    #[error("Max total staked amount exceeded")]
210    ExceededMaxTotalStakedAmount = 0x17B1,
211    /// 6066 - LP token price change exceeds limit
212    #[error("LP token price change exceeds limit")]
213    LpTokenPriceChangeLimitExceeded = 0x17B2,
214}
215
216impl From<PerpetualsError> for solana_program::program_error::ProgramError {
217    fn from(e: PerpetualsError) -> Self {
218        solana_program::program_error::ProgramError::Custom(e as u32)
219    }
220}