volt_abi/
error.rs

1use anchor_lang::error_code;
2
3#[error_code]
4pub enum ErrorCode {
5    #[msg("Expiration must be in the future")]
6    ExpirationIsInThePast,
7    #[msg("Same quote and underlying asset, cannot create market")]
8    QuoteAndUnderlyingAssetMustDiffer,
9    #[msg("Quote amount and underlying amount per contract must be > 0")]
10    QuoteOrUnderlyingAmountCannotBe0,
11    #[msg("OptionMarket must be the mint authority")]
12    OptionMarketMustBeMintAuthority,
13    #[msg("OptionMarket must own the underlying asset pool")]
14    OptionMarketMustOwnUnderlyingAssetPool,
15    #[msg("OptionMarket must own the quote asset pool")]
16    OptionMarketMustOwnQuoteAssetPool,
17    #[msg("Stop trying to spoof the SPL Token program! Shame on you")]
18    ExpectedSPLTokenProgramId,
19    #[msg("Mint fee account must be owned by the FEE_OWNER")]
20    MintFeeMustBeOwnedByFeeOwner,
21    #[msg("Exercise fee account must be owned by the FEE_OWNER")]
22    ExerciseFeeMustBeOwnedByFeeOwner,
23    #[msg("Mint fee token must be the same as the underlying asset")]
24    MintFeeTokenMustMatchUnderlyingAsset,
25    #[msg("Exercise fee token must be the same as the quote asset")]
26    ExerciseFeeTokenMustMatchQuoteAsset,
27    #[msg("OptionMarket is expired, can't mint")]
28    OptionMarketExpiredCantMint,
29    #[msg("Underlying pool account does not match the value on the OptionMarket")]
30    UnderlyingPoolAccountDoesNotMatchMarket,
31    #[msg("OptionToken mint does not match the value on the OptionMarket")]
32    OptionTokenMintDoesNotMatchMarket,
33    #[msg("WriterToken mint does not match the value on the OptionMarket")]
34    WriterTokenMintDoesNotMatchMarket,
35    #[msg("MintFee key does not match the value on the OptionMarket")]
36    MintFeeKeyDoesNotMatchOptionMarket,
37    #[msg("The size argument must be > 0")]
38    SizeCantBeLessThanEqZero,
39    #[msg("exerciseFee key does not match the value on the OptionMarket")]
40    ExerciseFeeKeyDoesNotMatchOptionMarket,
41    #[msg("Quote pool account does not match the value on the OptionMarket")]
42    QuotePoolAccountDoesNotMatchMarket,
43    #[msg("Underlying destination mint must match underlying asset mint address")]
44    UnderlyingDestMintDoesNotMatchUnderlyingAsset,
45    #[msg("Fee owner does not match the program's fee owner")]
46    FeeOwnerDoesNotMatchProgram,
47    #[msg("OptionMarket is expired, can't exercise")]
48    OptionMarketExpiredCantExercise,
49    #[msg("OptionMarket has not expired, can't close")]
50    OptionMarketNotExpiredCantClose,
51    #[msg("Not enough assets in the quote asset pool")]
52    NotEnoughQuoteAssetsInPool,
53    #[msg("Invalid auth token provided")]
54    InvalidAuth,
55    #[msg("Coin mint must match option mint")]
56    CoinMintIsNotOptionMint,
57    #[msg("Cannot prune the market while it's still active")]
58    CannotPruneActiveMarket,
59    #[msg("Numerical overflow")]
60    NumberOverflow,
61    #[msg("Invalid order type")]
62    InvalidOrderType,
63    #[msg("Invalid self trade behavior")]
64    InvalidSelfTradeBehavior,
65    #[msg("Unauthorized.")]
66    Unauthorized,
67    #[msg("Insufficient collateral to write options.")]
68    InsufficientCollateralForWriting,
69    #[msg("Insufficient Vault tokens to redeem.")]
70    InsufficientVaultTokens,
71    #[msg("Options contract is expired.")]
72    ContractExpired,
73    #[msg("Cannot redeem until contract expiry.")]
74    ContractNotYetExpired,
75    #[msg("mint amount was 0, skipping mint_helper()...")]
76    InvalidMintAmount,
77    #[msg("invalid time to exit position rebalanceExit()")]
78    InvalidRebalanceExitTime,
79    #[msg("invalid time to enter position rebalanceEnter()")]
80    InvalidRebalanceEntryTime,
81    #[msg("invalid time to call rebalancePrepare()")]
82    InvalidRebalancePrepareTime,
83    #[msg("invalid time to withdraw")]
84    InvalidWithdrawalTime,
85    #[msg("invalid time to deposit")]
86    InvalidDepositTime,
87    #[msg("invalid time to set next option")]
88    InvalidSetNextOptionTime,
89    #[msg("invalid deposit amount")]
90    InvalidDepositAmount,
91    #[msg("invalid rebalance settle time")]
92    InvalidRebalanceSettleTime,
93    #[msg("invalid rebalance settle state")]
94    InvalidRebalanceSettleState,
95    #[msg("invalid rebalance enter state")]
96    InvalidRebalanceEnterState,
97    #[msg("options position not settled, must be before withdrawal")]
98    OptionsPositionNotSettled,
99    #[msg("non underlying pools have assets when attempting withdraw")]
100    NonUnderlyingPoolsHaveAssets,
101
102    #[msg("volt must be vault mint authority")]
103    VaultAuthorityMustBeVaultMintAuthority,
104    #[msg("volt must own deposit pool")]
105    VaultAuthorityMustOwnDepositPool,
106    #[msg("volt must own premium pool")]
107    VaultAuthorityMustOwnPremiumPool,
108    #[msg("volt must own writer token pool")]
109    VoltVaulttMustOwnWriterTokenPool,
110    #[msg("volt must own option pool")]
111    VoltVaultMustOwnOptionPool,
112
113    #[msg("DepositPoolDoesNotMatchVoltVault")]
114    DepositPoolDoesNotMatchVoltVault,
115    #[msg("OptionPoolDoesNotMatchVoltVault")]
116    OptionPoolDoesNotMatchVoltVault,
117    #[msg("PremiumPoolDoesNotMatchVoltVault")]
118    PremiumPoolDoesNotMatchVoltVault,
119    #[msg("TradingPoolDoesNotMatchVoltVault")]
120    TraidngPoolDoesNotMatchVoltVault,
121    #[msg("option mint does not match option market")]
122    OptionMintDoesNotMatchOptionMarket,
123
124    #[msg("NoBidsInOptionOrderBook")]
125    NoOrdersInOptionOrderBook,
126
127    #[msg("cpi program must be Some in place order")]
128    CpiProgramMustBeSomeInPlaceOrder,
129
130    #[msg("new option must not be expired")]
131    NewOptionMustNotBeExpired,
132    #[msg("new option has roughly target expiry (within lower/upper bounds)")]
133    NewOptionMustHaveExactExpiry,
134    #[msg("new option has wrong underlying asset")]
135    NewOptionHasWrongUnderlyingAsset,
136    #[msg("new option has wrong quote asset")]
137    NewOptionHasWrongQuoteAsset,
138    #[msg("new option has wrong contract size")]
139    NewOptionHasWrongContractSize,
140    #[msg("new option has invalid strike")]
141    NewOptionHasInvalidStrike,
142    #[msg("rebalance settle has leftover writer tokens")]
143    RebalanceSettleHasLeftoverWriterTokens,
144    #[msg("current option must not be expired")]
145    CurrentOptionMustNotBeExpired,
146    #[msg("cannot reinitialize an (already initialized) volt")]
147    CannotReinitializeVolt,
148    #[msg("cannot reinitialize an (already initialized) volt")]
149    OldOptionAndWriterTokenPoolsMustBeEmpty,
150    #[msg("invalid old option writer token pools")]
151    InvalidOldOptionWriterTokenPools,
152
153    #[msg("vault mint does not match user token account")]
154    VaultMintDoesNotMatchUserTokenAccount,
155    #[msg("deposit pool mint does not match user token account")]
156    DepositPoolMintDoesNotMatchUserTokenAccount,
157    #[msg("vault authority does not match")]
158    VaultAuthorityDoesNotMatch,
159    #[msg("DEX program id does not match")]
160    DexProgramIdDoesNotMatchAnchor,
161    #[msg("Inertia program id does not match")]
162    InertiaProgramIdDoesNotMatch,
163    #[msg("Invalid authority for permissioned instruction")]
164    InvalidAuthorityForPermissionedInstruction,
165    #[msg("writer token mint does not match option market")]
166    WriterTokenMintDoesNotMatchOptionMarket,
167    #[msg("option market should be owned by protocol (e.g inertia)")]
168    OptionMarketMustBeOwnedByProtocol,
169    #[msg("underlying asset mint does not match voltvault")]
170    UnderlyingAssetMintDoesNotMatchVoltVault,
171    #[msg("quote asset mint does not match voltvault")]
172    QuoteAssetMintDoesNotMatchVoltVault,
173    #[msg("vault mint does not match volt vault")]
174    VaultMintDoesNotMatchVoltVault,
175    #[msg("option market does not match volt vault")]
176    OptionMarketDoesNotMatchVoltVault,
177    #[msg("writer token pool does not match volt vault")]
178    WriterTokenPoolDoesNotMatchVoltVault,
179    #[msg("invalid rebalance swap premium state")]
180    InvalidRebalanceSwapPremiumState,
181    #[msg("should be unreachable code")]
182    ShouldBeUnreachable,
183    #[msg("shouldn't have multiple pending deposits")]
184    CantHaveMultiplePendingDeposits,
185    #[msg("invalid start round state")]
186    InvalidStartRoundState,
187    #[msg("invalid set next option state")]
188    InvalidSetNextOptionState,
189    #[msg("invalid claim pending state")]
190    InvalidClaimPendingState,
191    #[msg("invalid end round state")]
192    InvalidEndRoundState,
193    #[msg("shouldn't have multiple pending withdrawals")]
194    CantHaveMultiplePendingWithdrawals,
195    #[msg("invalid claim pending withdrawal state")]
196    InvalidClaimPendingWithdrawalState,
197    #[msg("invalid next option market")]
198    InvalidNextOptionMarket,
199    #[msg("Auth token not revoked")]
200    TokenNotRevoked,
201    #[msg("user is not whitelisted")]
202    NonWhitelistedUser,
203    #[msg("user is not signer")]
204    UserIsNotSigner,
205    #[msg("authority does not match whitelist admin")]
206    InvalidWhitelistAuthority,
207    #[msg("whitelist and option market do not generate correct PDA")]
208    InvalidWhitelistAndOptionMarketCombination,
209    #[msg("round volt tokens mint does not match volt vault")]
210    RoundVoltTokensMintDoesNotMatchVoltVault,
211    #[msg("round underlying tokens mint does not match volt vault")]
212    RoundUnderlyingTokensMintDoesNotMatchVoltVault,
213    #[msg("UnderlyingAssetPoolDoesNotMatchOptionMarket")]
214    UnderlyingAssetPoolDoesNotMatchOptionMarket,
215    #[msg("no opposite order on serum market")]
216    NoOppositeOrderOnSerumMarket,
217    #[msg("bid price on serum market too low")]
218    BidPriceOnSerumMarketTooLow,
219    #[msg("offer price on serum market too high")]
220    OfferPriceOnSerumMarketTooHigh,
221    #[msg("underlying open orders does not match volt vault")]
222    UnderlyingOpenOrdersDoesNotMatchVoltVault,
223    #[msg("must have at least one market maker access token")]
224    MustHaveAtLeastOneMarketMakerAccessToken,
225    #[msg("middleware program id does not match expected")]
226    MiddlewareProgramIdDoesNotMatch,
227    #[msg("fee account owner does not match expected")]
228    FeeAccountOwnerDoesNotMatch,
229    #[msg("fee account mint does not match deposit pool")]
230    FeeAccountMintDoesNotMatchDepositPool,
231    #[msg("vault capacity would be exceeded")]
232    VaultCapacityWouldBeExceeded,
233    #[msg("individual deposit capacity would be exceeded")]
234    IndividualDepositCapacityWouldBeExceeded,
235    #[msg("unsupported option market program ID")]
236    UnsupportedOptionMarketProgramId,
237    #[msg("invalid end dca round state")]
238    InvalidEndDcaRoundState,
239    #[msg("round has not started")]
240    RoundHasNotStarted,
241    #[msg("permissioned makret premium pool does not match volt")]
242    PermissionedMarketPremiumPoolDoesNotMatchVoltVault,
243    #[msg("token account owners do not match")]
244    TokenAccountOwnersDoNotMatch,
245    #[msg("invalid permissioned market premium mint")]
246    InvalidPermissionedMarketPremiumMint,
247    #[msg("premium pool amount must be greater than zero")]
248    PremiumPoolAmountMustBeGreaterThanZero,
249    #[msg("can't close non empty token account")]
250    CantCloseNonEmptyTokenAccount,
251    #[msg("must finish entering before settling permissioned market premium funds")]
252    MustFinishEnteringBeforeSettlingPermissionedMarketPremium,
253    #[msg("pending withdrawal info must be initialized")]
254    PendingWithdrawalInfoNotInitialized,
255    #[msg("pending withdrawal does not exist")]
256    PendingWithdrawalDoesNotExist,
257    #[msg("cannot cancel pending withdrawal from old round")]
258    CannotCancelPendingWithdrawalFromOldRound,
259    #[msg("pending deposit info not initialized")]
260    PendingDepositInfoNotInitialized,
261    #[msg("pending deposits does not exist")]
262    PendingDepositDoesNotExist,
263    #[msg("cannot cancel pending deposit from old round")]
264    CannotCancelPendingDepositFromOldRound,
265    #[msg("vault destination does not match volt vault")]
266    VaultDestinationDoesNotMatchVoltVault,
267    #[msg("must take withdrawal fees before starting round")]
268    MustTakeWithdrawalFeesBeforeStartingRound,
269    #[msg("round must be ended")]
270    RoundMustBeEnded,
271    #[msg("must not have sold option tokens to reset")]
272    MustNotHaveSoldOptionTokens,
273    #[msg("cannot close account unless empty")]
274    CantCloseAccountUnlessEmpty,
275    #[msg("open orders must be empty to close")]
276    OpenOrderMustBeEmptyToClose,
277    #[msg("invalid whitelist account (vector)")]
278    InvalidWhitelistAccountVector,
279    #[msg("invalid dao program ID")]
280    InvalidDaoProgramId,
281    #[msg("volt must be for dao")]
282    VoltMustBeForDao,
283    #[msg("invalid dao authority")]
284    InvalidDaoAuthority,
285    #[msg("dao authority must sign")]
286    DaoAuthorityMustSign,
287    #[msg("invalid pending deposit key")]
288    InvalidPendingDepositKey,
289    #[msg("invalid authority check")]
290    InvalidAuthorityCheck,
291    #[msg("entropy: invalid end entropy round state")]
292    InvalidEndEntropyRoundState,
293    #[msg("invalid volt type")]
294    InvalidVoltType,
295    #[msg("can't find perp market index")]
296    CantFindPerpMarketIndex,
297    #[msg("account equity less than zero")]
298    AccountEquityLessThanZero,
299    #[msg("quote position changed too much")]
300    QuotePositionChangedTooMuch,
301    #[msg("must move closer to target collateralization")]
302    MustMoveCloserToTargetCollateralization,
303    #[msg("collateral not within lenience")]
304    CollateralNotWithinLenience,
305    #[msg("invalid rebalance entropy state")]
306    InvalidRebalanceEntropyState,
307    #[msg("volt must have negative base position (be short)")]
308    BasePositionMustBeNegative,
309    #[msg("volt must have positive quote position (be short)")]
310    QuotePositionMustBePositive,
311    #[msg("target collateral ratio must be neggat")]
312    TargetCollateralRatioMustBeNegative,
313    #[msg("new equity must be higher than deposit amt")]
314    NewEquityMustBeHigherThanDepositAmount,
315    #[msg("instant transfers must be enabled")]
316    InstantTransfersMustBeDisabled,
317    #[msg("rebalance must be ready")]
318    RebalanceMustBeReady,
319    #[msg("spot hedge unbalanced")]
320    IncorrectHedge,
321    #[msg("vault name must be zero length")]
322    VaultNameMustBeNonZeroLength,
323    #[msg("vault does not support over leveraged strategies")]
324    VaultDoesNotSupportOverLeveragedStrategies,
325    #[msg("lenience must be greater than zero")]
326    LenienceMustBeGreaterThanZero,
327    #[msg("lenience should not be greater than leverage")]
328    LenienceShouldNotBeGreaterThanLeverage,
329    #[msg("hedge lenience should be greater than leverage")]
330    HedgeLenienceMustBeGreaterThanZero,
331    #[msg("exit early ratio must be < 1.0")]
332    VaultDoesNotSupportExitEarlyOverLeveragedStrategies,
333    #[msg("round number must not overflow")]
334    RoundNumberMustNotOverflow,
335    #[msg("invalid whitelist token account mint")]
336    InvalidWhitelistTokenAccountMint,
337    #[msg("soloptions program id does not matchf")]
338    SoloptionsProgramIdDoesNotMatch,
339    #[msg("whitelist token account owner is not user")]
340    WhitelistTokenAccountOwnerIsNotUser,
341    #[msg("sol transfer authority must be owned by volt program")]
342    SolTransferAuthorityMustNotBeOwnedByVoltProgram,
343    #[msg("Insufficient collateral to deposit.")]
344    InsufficientCollateralForDeposit,
345    #[msg("sol transfer authority must be writable/signer")]
346    SolTransferAuthorityMustBeWritableAndSigner,
347    #[msg("volt must be entropy type")]
348    VoltMustBeOfEntropyType,
349    #[msg("volt must be of short options type")]
350    VoltMustBeofShortOptionsType,
351    #[msg("deposits and withdrawals are turned off")]
352    DepositsAndWithdrawalsAreTurnedOff,
353    #[msg("unrecognized entropy program id")]
354    UnrecognizedEntropyProgramId,
355    #[msg("invalid take performance fees state")]
356    InvalidTakePerformanceFeesState,
357    #[msg("discriminator does not match")]
358    DiscriminatorDoesNotMatch,
359    #[msg("realized oracle price too far off client provided")]
360    RealizedOraclePriceTooFarOffClientProvided,
361    #[msg("vault mint supply must be zero if equity is zero")]
362    VaultMintSupplyMustBeZeroIfEquityIsZero,
363    #[msg("invalid setup rebalance entropy state")]
364    InvalidSetupRebalanceEntropyState,
365}