reflect_sdk/generated/errors/
reflect_main.rs1use num_derive::FromPrimitive;
9use thiserror::Error;
10
11#[derive(Clone, Debug, Eq, Error, FromPrimitive, PartialEq)]
12pub enum ReflectMainError {
13 #[error("Number of recipients wrong")]
15 MissingRecipient = 0x1770,
16 #[error("Number of recipients can't be zero")]
18 NoRecipients = 0x1771,
19 #[error("Recipients can't exceed limit")]
21 TooManyRecipients = 0x1772,
22 #[error("Provided wrong recipient or in incorrect order")]
24 IncorrectRecipient = 0x1773,
25 #[error("Component does not exist in this account")]
27 ComponentNotFound = 0x1774,
28 #[error("Invalid component type")]
30 InvalidComponentType = 0x1775,
31 #[error("Component registry is full")]
33 ComponentRegistryFull = 0x1776,
34 #[error("Component size exceeds maximum allowed")]
36 ComponentTooLarge = 0x1777,
37 #[error("No more space for component data")]
39 ComponentDataExhausted = 0x1778,
40 #[error("Component exists already")]
42 ComponentAlreadyExists = 0x1779,
43 #[error("Cap can't be lower than what has been minted")]
45 TooLowCap = 0x177A,
46 #[error("No more stable can be minted under this cap settings")]
48 CapExceeded = 0x177B,
49 #[error("Out of bounds access")]
51 OutOfBounds = 0x177C,
52 #[error("Invalid data length")]
54 BadLen = 0x177D,
55 #[error("This strategy already supports this SPL")]
57 StrategyAlreadySupportsSpl = 0x177E,
58 #[error("Protocol already supports this SPL")]
60 ProtocolAlreadySupportsSpl = 0x177F,
61 #[error("Not enough funds for this transaction")]
63 NotEnoughSplInput = 0x1780,
64 #[error("SPL not found")]
66 SplNotFound = 0x1781,
67 #[error("Provided SPL mint is not supported at the strategy")]
69 StrategyDoesNotSupportSpl = 0x1782,
70 #[error("Provided wrong mint account")]
72 IncorrectMint = 0x1783,
73 #[error("Need the correct number of the accounts in the remaining")]
75 IncorrectNumberOfAccounts = 0x1784,
76 #[error("Incorrect mint address for this strategy")]
78 IncorrectReflectStrategyMint = 0x1785,
79 #[error("Incorrect token address for reflect token account")]
81 IncorrectReflectTokenAccount = 0x1786,
82 #[error("Slippage protection triggered for SPL redeem")]
84 OutputAmountTooLow = 0x1787,
85 #[error("Cannot mint stable using this SPL at this strategy")]
87 SplMintFrozen = 0x1788,
88 #[error("Token account of a different accoutn is needed for withdraw")]
90 IncorrectWithdrawMint = 0x1789,
91 #[error("Provided wrong token account")]
93 InvalidTokenAccount = 0x178A,
94 #[error("Provided permissions account does not match the caller")]
96 IncorrectAdminAccount = 0x178B,
97 #[error("Caller does not have the privilege for this action")]
99 MissingAdminPrivallages = 0x178C,
100 #[error("Can't remove the last admin")]
102 LastAdmin = 0x178D,
103 #[error("Special call for supremo removal")]
105 SupremoOnly = 0x178E,
106 #[error("You've provided same admin account")]
108 SameAdmin = 0x178F,
109 #[error("User does not have such role")]
111 UserLacksRole = 0x1790,
112 #[error("User already has requested role")]
114 UserAlreadyHasRole = 0x1791,
115 #[error("This action lacks specified role")]
117 RoleNotUnderAction = 0x1792,
118 #[error("Action not found")]
120 ActionNotFound = 0x1793,
121 #[error("This action can already be performed by this role")]
123 ActionHasAssignedRole = 0x1794,
124 #[error("This action can only be performed by a supreme authority")]
126 SupremoOnlyAction = 0x1795,
127 #[error("Only supreme authorities can assign supreme authority roles")]
129 CannotAssignSupremo = 0x1796,
130 #[error("Desired state is already on")]
132 AlreadyThere = 0x1797,
133 #[error("Action already frozen")]
135 AlreadyFrozen = 0x1798,
136 #[error("Action already unfrozen")]
138 AlreadyUnfrozen = 0x1799,
139 #[error("Program already registered")]
141 ProgramAlreadyExists = 0x179A,
142 #[error("Supplied program can not be used")]
144 InvalidProgram = 0x179B,
145 #[error("Supplied program account can not be used")]
147 InvalidProgramAccount = 0x179C,
148 #[error("Neceessary account not provided")]
150 MissingAccount = 0x179D,
151 #[error("Math error")]
153 MathError = 0x179E,
154 #[error("Can't transmute")]
156 ConversionFailed = 0x179F,
157 #[error("Mathematical operation overflow")]
159 MathOverflow = 0x17A0,
160 #[error("Can't divide by zero")]
162 DivisionByZero = 0x17A1,
163 #[error("Invalid data provided")]
165 InvalidData = 0x17A2,
166 #[error("Invalid state")]
168 InvalidState = 0x17A3,
169 #[error("Invalid input")]
171 InvalidInput = 0x17A4,
172 #[error("Could not load the price account")]
174 PythError = 0x17A5,
175 #[error("Failed unwrap")]
177 FailedUnwrap = 0x17A6,
178 #[error("Difference is too small to capture")]
180 SpreadTooSmall = 0x17A7,
181 #[error("Serialisation failed")]
183 SerialisationFailed = 0x17A8,
184 #[error("Deserialisation failed")]
186 DeserialisationFailed = 0x17A9,
187 #[error("Item could not be added")]
189 NoEntriesLeft = 0x17AA,
190 #[error("Provided wrong controller")]
192 InvalidController = 0x17AB,
193 #[error("This action is suspended")]
195 ActionFrozen = 0x17AC,
196 #[error("This configuration leads to an impossibility")]
198 AttenuationExceedsMaximum = 0x17AD,
199 #[error("At least one parameter must be provided")]
201 InvalidAttenuationParameters = 0x17AE,
202 #[error("Capture failed")]
204 CaptureProblem = 0x17AF,
205 #[error("All payout parties must add up to 100.0%")]
207 InvalidRatios = 0x17B0,
208 #[error("PerpMarketNotFound")]
210 PerpMarketNotFound = 0x17B1,
211 #[error("UnableToLoadMarketAccount")]
213 UnableToLoadPerpMarketAccount = 0x17B2,
214 #[error("InvalidMarketAccount")]
216 InvalidMarketAccount = 0x17B3,
217 #[error("CouldNotLoadMarketData")]
219 CouldNotLoadMarketData = 0x17B4,
220 #[error("MarketWrongMutability")]
222 MarketWrongMutability = 0x17B5,
223 #[error("SpotMarketWrongMutability")]
225 SpotMarketWrongMutability = 0x17B6,
226 #[error("UnableToLoadSpotMarketAccount")]
228 UnableToLoadSpotMarketAccount = 0x17B7,
229 #[error("InvalidSpotMarketAccount")]
231 InvalidSpotMarketAccount = 0x17B8,
232 #[error("CouldNotLoadSpotMarketData")]
234 CouldNotLoadSpotMarketData = 0x17B9,
235 #[error("Position has unsettled PnL and must be settled first")]
237 UnsettledPnl = 0x17BA,
238 #[error("Unable To Load Oracles")]
240 UnableToLoadOracle = 0x17BB,
241 #[error("OracleNotFound")]
243 OracleNotFound = 0x17BC,
244 #[error("InvalidOracle")]
246 InvalidOracle = 0x17BD,
247 #[error("SpotMarketNotFound")]
249 SpotMarketNotFound = 0x17BE,
250 #[error("InvalidOracle")]
252 InvalidOracleSource = 0x17BF,
253 #[error("Position does not exist.")]
255 MissingPositon = 0x17C0,
256 #[error("SPL input is less than the minimum position change.")]
258 BelowMinPositionChange = 0x17C1,
259 #[error("SPL input is less than the minimum position.")]
261 BelowMinPosition = 0x17C2,
262 #[error("Drift only supports 8 spot accounts")]
264 DriftMaxSpots = 0x17C3,
265 #[error("My main man is to suffer no sneaky haircuts")]
267 DriftWithdrawlFee = 0x17C4,
268 #[error("SPL not supported")]
270 SplNotSupported = 0x17C5,
271 #[error("Provided spot account does not match the expected spot account")]
273 IncorrectSpot = 0x17C6,
274 #[error("Market index not supported")]
276 DriftMarketIndexNotSupported = 0x17C7,
277 #[error("Provided drift state account is incorrect")]
279 IncorrectReflectState = 0x17C8,
280 #[error("Drift post CPI state of orders and/or base asset amount didn't show decrease")]
282 IncorrectReduction = 0x17C9,
283 #[error("Drift post CPI state of orders and/or base asset amount didn't show increase")]
285 IncorrectIncrease = 0x17CA,
286 #[error("Can't create a new subaccount")]
288 SubAccountNotFull = 0x17CB,
289 #[error("Not enough USDC for this deposit")]
291 UsdcSplTooLow = 0x17CC,
292 #[error("Specified perp position not found")]
294 PerpPositionNotFound = 0x17CD,
295 #[error("InvalidJlpOracle")]
297 InvalidJlpOracle = 0x17CE,
298 #[error("Mint of this custody is not hedged")]
300 CustodyNotHedged = 0x17CF,
301 #[error("Incorrect JLP account supplied")]
303 IncorrectJlpAccount = 0x17D0,
304 #[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