ore/
error.rs

1use num_enum::IntoPrimitive;
2use solana_program::program_error::ProgramError;
3use thiserror::Error;
4
5#[derive(Debug, Error, Clone, Copy, PartialEq, Eq, IntoPrimitive)]
6#[repr(u32)]
7pub enum OreError {
8    #[error("The starting time has not passed yet")]
9    NotStarted = 0,
10    #[error("The epoch has ended and needs reset")]
11    NeedsReset = 1,
12    #[error("The epoch is active and cannot be reset at this time")]
13    ResetTooEarly = 2,
14    #[error("The provided hash was invalid")]
15    HashInvalid = 3,
16    #[error("The provided hash does not satisfy the difficulty requirement")]
17    DifficultyNotSatisfied = 4,
18    #[error("The bus does not have enough rewards to issue at this time")]
19    BusRewardsInsufficient = 5,
20    #[error("The claim amount cannot be greater than the claimable rewards")]
21    ClaimTooLarge = 6,
22}
23
24impl From<OreError> for ProgramError {
25    fn from(e: OreError) -> Self {
26        ProgramError::Custom(e as u32)
27    }
28}