Skip to main content

roshi_interface/
error.rs

1use solana_program_error::ProgramError;
2
3#[repr(u32)]
4#[derive(Clone, Copy, Debug, Eq, PartialEq)]
5pub enum RoshiError {
6    InvalidOp = 0,
7    InstructionSliceOutOfBounds = 1,
8    AccountIndexOutOfBounds = 2,
9    InvalidBps = 3,
10    VaultPaused = 4,
11    UnauthorizedAction = 5,
12    InvalidProgramConfigAccount = 6,
13    InvalidVaultAccount = 7,
14    InvalidActionAccount = 8,
15    InvalidWithdrawalTicketAccount = 9,
16    InvalidAssetAccount = 10,
17    InvalidAccessProof = 11,
18    InvalidVaultTag = 12,
19    DivisionByZero = 13,
20    InvalidDecimals = 14,
21    InvalidVaultState = 15,
22    Overflow = 16,
23    ResultDoesNotFit = 17,
24    ZeroOutput = 18,
25    SlippageExceeded = 19,
26    InvalidTokenAccount = 20,
27    InvalidMintAccount = 21,
28    ExternalDisabled = 22,
29    WithdrawalExceedsEntitlement = 23,
30    InsufficientShares = 24,
31    InvalidSubAccount = 25,
32    InvalidExternalDestinationAccount = 26,
33    InvalidWriteDownAmount = 27,
34    StaleNavReport = 28,
35    NavGainExceedsBound = 29,
36    ReportTooFrequent = 30,
37    DepositCapExceeded = 31,
38    ExternalDestinationNotRegistered = 32,
39    UnpriceableSwapLeg = 33,
40    MissingInstructionsSysvar = 34,
41    RequiredSiblingMissing = 35,
42    FlashDelegateUnbounded = 36,
43    FlashDelegateMismatch = 37,
44    FlashDestinationMismatch = 38,
45    SiblingsRequireTopLevel = 39,
46    DelegateNotCleared = 40,
47    FlashFeeRateNotLower = 41,
48}
49
50impl From<RoshiError> for ProgramError {
51    fn from(error: RoshiError) -> Self {
52        ProgramError::Custom(error as u32)
53    }
54}