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 epoch has ended and needs reset")]
9 NeedsReset = 0,
10 #[error("The provided hash is invalid")]
11 HashInvalid = 1,
12 #[error("The provided hash did not satisfy the minimum required difficulty")]
13 HashTooEasy = 2,
14 #[error("The claim amount cannot be greater than the claimable rewards")]
15 ClaimTooLarge = 3,
16 #[error("The clock time is invalid")]
17 ClockInvalid = 4,
18 #[error("You are trying to submit too soon")]
19 Spam = 5,
20 #[error("The maximum supply has been reached")]
21 MaxSupply = 6,
22 #[error("The proof does not match the expected account")]
23 AuthFailed = 7,
24}
25
26impl From<OreError> for ProgramError {
27 fn from(e: OreError) -> Self {
28 ProgramError::Custom(e as u32)
29 }
30}