Skip to main content

streak_api/
error.rs

1use steel::*;
2
3#[repr(u32)]
4#[derive(Debug, Error, Clone, Copy, PartialEq, Eq, IntoPrimitive)]
5pub enum StreakError {
6    #[error("Invalid instruction data")]
7    InvalidInstruction = 0,
8    #[error("Program already initialized")]
9    AlreadyInitialized = 1,
10    #[error("Signer is not authorized for this instruction")]
11    Unauthorized = 2,
12    #[error("Account does not match expected PDA")]
13    BadPda = 3,
14    #[error("Program not initialized — call Initialize first")]
15    NotInitialized = 4,
16    #[error("Arithmetic overflow")]
17    Overflow = 5,
18    #[error("Mint mismatch")]
19    BadMint = 6,
20    #[error("Treasury balance insufficient for payout")]
21    InsufficientTreasury = 9,
22    #[error("Deposit amount must be > 0")]
23    ZeroAmount = 10,
24    #[error("Price account owner is not the Pyth program")]
25    PythBadOwner = 21,
26    #[error("Could not parse Pyth price account")]
27    PythInvalidAccount = 22,
28    #[error("Pyth price is stale (exceeds PYTH_MAX_PRICE_AGE_SECS)")]
29    OraclePriceStale = 23,
30    #[error("Could not normalize oracle prices for comparison")]
31    OracleNormalize = 24,
32    #[error("Genesis price not set — call Initialize to seed the treasury price chain")]
33    GenesisNotSet = 47,
34}
35
36error!(StreakError);