Skip to main content

reflect_sdk/generated/errors/
reflect_main.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 ReflectMainError {
13    /// 6000 - Number of recipients wrong
14    #[error("Number of recipients wrong")]
15    MissingRecipient = 0x1770,
16    /// 6001 - Number of recipients can't be zero
17    #[error("Number of recipients can't be zero")]
18    NoRecipients = 0x1771,
19    /// 6002 - Recipients can't exceed limit
20    #[error("Recipients can't exceed limit")]
21    TooManyRecipients = 0x1772,
22    /// 6003 - Provided wrong recipient or in incorrect order
23    #[error("Provided wrong recipient or in incorrect order")]
24    IncorrectRecipient = 0x1773,
25    /// 6004 - Component does not exist in this account
26    #[error("Component does not exist in this account")]
27    ComponentNotFound = 0x1774,
28    /// 6005 - Invalid component type
29    #[error("Invalid component type")]
30    InvalidComponentType = 0x1775,
31    /// 6006 - Component registry is full
32    #[error("Component registry is full")]
33    ComponentRegistryFull = 0x1776,
34    /// 6007 - Component size exceeds maximum allowed
35    #[error("Component size exceeds maximum allowed")]
36    ComponentTooLarge = 0x1777,
37    /// 6008 - No more space for component data
38    #[error("No more space for component data")]
39    ComponentDataExhausted = 0x1778,
40    /// 6009 - Component exists already
41    #[error("Component exists already")]
42    ComponentAlreadyExists = 0x1779,
43    /// 6010 - Cap can't be lower than what has been minted
44    #[error("Cap can't be lower than what has been minted")]
45    TooLowCap = 0x177A,
46    /// 6011 - No more stable can be minted under this cap settings
47    #[error("No more stable can be minted under this cap settings")]
48    CapExceeded = 0x177B,
49    /// 6012 - Out of bounds access
50    #[error("Out of bounds access")]
51    OutOfBounds = 0x177C,
52    /// 6013 - Invalid data length
53    #[error("Invalid data length")]
54    BadLen = 0x177D,
55    /// 6014 - This strategy already supports this SPL
56    #[error("This strategy already supports this SPL")]
57    StrategyAlreadySupportsSpl = 0x177E,
58    /// 6015 - Protocol already supports this SPL
59    #[error("Protocol already supports this SPL")]
60    ProtocolAlreadySupportsSpl = 0x177F,
61    /// 6016 - Not enough funds for this transaction
62    #[error("Not enough funds for this transaction")]
63    NotEnoughSplInput = 0x1780,
64    /// 6017 - SPL not found
65    #[error("SPL not found")]
66    SplNotFound = 0x1781,
67    /// 6018 - Provided SPL mint is not supported at the strategy
68    #[error("Provided SPL mint is not supported at the strategy")]
69    StrategyDoesNotSupportSpl = 0x1782,
70    /// 6019 - Provided wrong mint account
71    #[error("Provided wrong mint account")]
72    IncorrectMint = 0x1783,
73    /// 6020 - Need the correct number of the accounts in the remaining
74    #[error("Need the correct number of the accounts in the remaining")]
75    IncorrectNumberOfAccounts = 0x1784,
76    /// 6021 - Incorrect mint address for this strategy
77    #[error("Incorrect mint address for this strategy")]
78    IncorrectReflectStrategyMint = 0x1785,
79    /// 6022 - Incorrect token address for reflect token account
80    #[error("Incorrect token address for reflect token account")]
81    IncorrectReflectTokenAccount = 0x1786,
82    /// 6023 - Slippage protection triggered for SPL redeem
83    #[error("Slippage protection triggered for SPL redeem")]
84    OutputAmountTooLow = 0x1787,
85    /// 6024 - Cannot mint stable using this SPL at this strategy
86    #[error("Cannot mint stable using this SPL at this strategy")]
87    SplMintFrozen = 0x1788,
88    /// 6025 - Token account of a different accoutn is needed for withdraw
89    #[error("Token account of a different accoutn is needed for withdraw")]
90    IncorrectWithdrawMint = 0x1789,
91    /// 6026 - Provided wrong token account
92    #[error("Provided wrong token account")]
93    InvalidTokenAccount = 0x178A,
94    /// 6027 - Provided permissions account does not match the caller
95    #[error("Provided permissions account does not match the caller")]
96    IncorrectAdminAccount = 0x178B,
97    /// 6028 - Caller does not have the privilege for this action
98    #[error("Caller does not have the privilege for this action")]
99    MissingAdminPrivallages = 0x178C,
100    /// 6029 - Can't remove the last admin
101    #[error("Can't remove the last admin")]
102    LastAdmin = 0x178D,
103    /// 6030 - Special call for supremo removal
104    #[error("Special call for supremo removal")]
105    SupremoOnly = 0x178E,
106    /// 6031 - You've provided same admin account
107    #[error("You've provided same admin account")]
108    SameAdmin = 0x178F,
109    /// 6032 - User does not have such role
110    #[error("User does not have such role")]
111    UserLacksRole = 0x1790,
112    /// 6033 - User already has requested role
113    #[error("User already has requested role")]
114    UserAlreadyHasRole = 0x1791,
115    /// 6034 - This action lacks specified role
116    #[error("This action lacks specified role")]
117    RoleNotUnderAction = 0x1792,
118    /// 6035 - Action not found
119    #[error("Action not found")]
120    ActionNotFound = 0x1793,
121    /// 6036 - This action can already be performed by this role
122    #[error("This action can already be performed by this role")]
123    ActionHasAssignedRole = 0x1794,
124    /// 6037 - This action can only be performed by a supreme authority
125    #[error("This action can only be performed by a supreme authority")]
126    SupremoOnlyAction = 0x1795,
127    /// 6038 - Only supreme authorities can assign supreme authority roles
128    #[error("Only supreme authorities can assign supreme authority roles")]
129    CannotAssignSupremo = 0x1796,
130    /// 6039 - Desired state is already on
131    #[error("Desired state is already on")]
132    AlreadyThere = 0x1797,
133    /// 6040 - Action already frozen
134    #[error("Action already frozen")]
135    AlreadyFrozen = 0x1798,
136    /// 6041 - Action already unfrozen
137    #[error("Action already unfrozen")]
138    AlreadyUnfrozen = 0x1799,
139    /// 6042 - Program already registered
140    #[error("Program already registered")]
141    ProgramAlreadyExists = 0x179A,
142    /// 6043 - Supplied program can not be used
143    #[error("Supplied program can not be used")]
144    InvalidProgram = 0x179B,
145    /// 6044 - Supplied program account can not be used
146    #[error("Supplied program account can not be used")]
147    InvalidProgramAccount = 0x179C,
148    /// 6045 - Neceessary account not provided
149    #[error("Neceessary account not provided")]
150    MissingAccount = 0x179D,
151    /// 6046 - Math error
152    #[error("Math error")]
153    MathError = 0x179E,
154    /// 6047 - Can't transmute
155    #[error("Can't transmute")]
156    ConversionFailed = 0x179F,
157    /// 6048 - Mathematical operation overflow
158    #[error("Mathematical operation overflow")]
159    MathOverflow = 0x17A0,
160    /// 6049 - Can't divide by zero
161    #[error("Can't divide by zero")]
162    DivisionByZero = 0x17A1,
163    /// 6050 - Invalid data provided
164    #[error("Invalid data provided")]
165    InvalidData = 0x17A2,
166    /// 6051 - Invalid state
167    #[error("Invalid state")]
168    InvalidState = 0x17A3,
169    /// 6052 - Invalid input
170    #[error("Invalid input")]
171    InvalidInput = 0x17A4,
172    /// 6053 - Could not load the price account
173    #[error("Could not load the price account")]
174    PythError = 0x17A5,
175    /// 6054 - Failed unwrap
176    #[error("Failed unwrap")]
177    FailedUnwrap = 0x17A6,
178    /// 6055 - Difference is too small to capture
179    #[error("Difference is too small to capture")]
180    SpreadTooSmall = 0x17A7,
181    /// 6056 - Serialisation failed
182    #[error("Serialisation failed")]
183    SerialisationFailed = 0x17A8,
184    /// 6057 - Deserialisation failed
185    #[error("Deserialisation failed")]
186    DeserialisationFailed = 0x17A9,
187    /// 6058 - Item could not be added
188    #[error("Item could not be added")]
189    NoEntriesLeft = 0x17AA,
190    /// 6059 - Provided wrong controller
191    #[error("Provided wrong controller")]
192    InvalidController = 0x17AB,
193    /// 6060 - This action is suspended
194    #[error("This action is suspended")]
195    ActionFrozen = 0x17AC,
196    /// 6061 - This configuration leads to an impossibility
197    #[error("This configuration leads to an impossibility")]
198    AttenuationExceedsMaximum = 0x17AD,
199    /// 6062 - At least one parameter must be provided
200    #[error("At least one parameter must be provided")]
201    InvalidAttenuationParameters = 0x17AE,
202    /// 6063 - Capture failed
203    #[error("Capture failed")]
204    CaptureProblem = 0x17AF,
205    /// 6064 - All payout parties must add up to 100.0%
206    #[error("All payout parties must add up to 100.0%")]
207    InvalidRatios = 0x17B0,
208    /// 6065 - PerpMarketNotFound
209    #[error("PerpMarketNotFound")]
210    PerpMarketNotFound = 0x17B1,
211    /// 6066 - UnableToLoadMarketAccount
212    #[error("UnableToLoadMarketAccount")]
213    UnableToLoadPerpMarketAccount = 0x17B2,
214    /// 6067 - InvalidMarketAccount
215    #[error("InvalidMarketAccount")]
216    InvalidMarketAccount = 0x17B3,
217    /// 6068 - CouldNotLoadMarketData
218    #[error("CouldNotLoadMarketData")]
219    CouldNotLoadMarketData = 0x17B4,
220    /// 6069 - MarketWrongMutability
221    #[error("MarketWrongMutability")]
222    MarketWrongMutability = 0x17B5,
223    /// 6070 - SpotMarketWrongMutability
224    #[error("SpotMarketWrongMutability")]
225    SpotMarketWrongMutability = 0x17B6,
226    /// 6071 - UnableToLoadSpotMarketAccount
227    #[error("UnableToLoadSpotMarketAccount")]
228    UnableToLoadSpotMarketAccount = 0x17B7,
229    /// 6072 - InvalidSpotMarketAccount
230    #[error("InvalidSpotMarketAccount")]
231    InvalidSpotMarketAccount = 0x17B8,
232    /// 6073 - CouldNotLoadSpotMarketData
233    #[error("CouldNotLoadSpotMarketData")]
234    CouldNotLoadSpotMarketData = 0x17B9,
235    /// 6074 - Position has unsettled PnL and must be settled first
236    #[error("Position has unsettled PnL and must be settled first")]
237    UnsettledPnl = 0x17BA,
238    /// 6075 - Unable To Load Oracles
239    #[error("Unable To Load Oracles")]
240    UnableToLoadOracle = 0x17BB,
241    /// 6076 - OracleNotFound
242    #[error("OracleNotFound")]
243    OracleNotFound = 0x17BC,
244    /// 6077 - InvalidOracle
245    #[error("InvalidOracle")]
246    InvalidOracle = 0x17BD,
247    /// 6078 - SpotMarketNotFound
248    #[error("SpotMarketNotFound")]
249    SpotMarketNotFound = 0x17BE,
250    /// 6079 - InvalidOracle
251    #[error("InvalidOracle")]
252    InvalidOracleSource = 0x17BF,
253    /// 6080 - Position does not exist.
254    #[error("Position does not exist.")]
255    MissingPositon = 0x17C0,
256    /// 6081 - SPL input is less than the minimum position change.
257    #[error("SPL input is less than the minimum position change.")]
258    BelowMinPositionChange = 0x17C1,
259    /// 6082 - SPL input is less than the minimum position.
260    #[error("SPL input is less than the minimum position.")]
261    BelowMinPosition = 0x17C2,
262    /// 6083 - Drift only supports 8 spot accounts
263    #[error("Drift only supports 8 spot accounts")]
264    DriftMaxSpots = 0x17C3,
265    /// 6084 - My main man is to suffer no sneaky haircuts
266    #[error("My main man is to suffer no sneaky haircuts")]
267    DriftWithdrawlFee = 0x17C4,
268    /// 6085 - SPL not supported
269    #[error("SPL not supported")]
270    SplNotSupported = 0x17C5,
271    /// 6086 - Provided spot account does not match the expected spot account
272    #[error("Provided spot account does not match the expected spot account")]
273    IncorrectSpot = 0x17C6,
274    /// 6087 - Market index not supported
275    #[error("Market index not supported")]
276    DriftMarketIndexNotSupported = 0x17C7,
277    /// 6088 - Provided drift state account is incorrect
278    #[error("Provided drift state account is incorrect")]
279    IncorrectReflectState = 0x17C8,
280    /// 6089 - Drift post CPI state of orders and/or base asset amount didn't show decrease
281    #[error("Drift post CPI state of orders and/or base asset amount didn't show decrease")]
282    IncorrectReduction = 0x17C9,
283    /// 6090 - Drift post CPI state of orders and/or base asset amount didn't show increase
284    #[error("Drift post CPI state of orders and/or base asset amount didn't show increase")]
285    IncorrectIncrease = 0x17CA,
286    /// 6091 - Can't create a new subaccount
287    #[error("Can't create a new subaccount")]
288    SubAccountNotFull = 0x17CB,
289    /// 6092 - Not enough USDC for this deposit
290    #[error("Not enough USDC for this deposit")]
291    UsdcSplTooLow = 0x17CC,
292    /// 6093 - Specified perp position not found
293    #[error("Specified perp position not found")]
294    PerpPositionNotFound = 0x17CD,
295    /// 6094 - InvalidJlpOracle
296    #[error("InvalidJlpOracle")]
297    InvalidJlpOracle = 0x17CE,
298    /// 6095 - Mint of this custody is not hedged
299    #[error("Mint of this custody is not hedged")]
300    CustodyNotHedged = 0x17CF,
301    /// 6096 - Incorrect JLP account supplied
302    #[error("Incorrect JLP account supplied")]
303    IncorrectJlpAccount = 0x17D0,
304    /// 6097 - TODO
305    #[error("TODO")]
306    ToDo = 0x17D1,
307}
308
309impl From<ReflectMainError> for solana_program_error::ProgramError {
310    fn from(e: ReflectMainError) -> Self {
311        solana_program_error::ProgramError::Custom(e as u32)
312    }
313}
314