miracle_api/
error.rs

1use steel::*;
2
3#[derive(Debug, Error, Clone, Copy, PartialEq, Eq, IntoPrimitive)]
4#[repr(u32)]
5pub enum MiracleError {
6    #[error("The maximum supply has been reached")]
7    MaxSupply = 0,
8    #[error("The starting time has not passed yet")]
9    NotStarted = 1,
10    #[error("Here we are, it's been a long journey, the Miracle Rewards Mission has finally come to an end.")]
11    HasEnded = 2,
12    // ===== PAYMENT-BASED REWARDS SYSTEM ERRORS =====
13    #[error("The epoch is invalid or out of range")]
14    InvalidEpoch = 3,
15    #[error("The oracle authority is invalid")]
16    InvalidOracleAuthority = 4,
17    #[error("The claim amount exceeds available rewards")]
18    ClaimAmountExceedsRewards = 5,
19    #[error("The claim amount exceeds threshold")]
20    ClaimAmountExceedsThreshold = 6,
21    #[error("The input parameters are invalid")]
22    InvalidInput = 7,
23    // ===== ENHANCED COMMUNITY METRICS VALIDATION ERRORS =====
24    #[error("The weights do not sum to 10000 (100%)")]
25    InvalidWeights = 8,
26    #[error("The retention rate is out of bounds (must be 0-10000)")]
27    InvalidRetentionRate = 9,
28    #[error("The community metrics calculation failed")]
29    MetricsCalculationFailed = 10,
30    #[error("The customer/merchant reward split is invalid (must sum to 10000)")]
31    InvalidRewardSplit = 11,
32    #[error("The activity count is out of bounds (must be 0-1,000,000)")]
33    InvalidActivityCount = 12,
34    // ===== SOCIAL MARKETING REWARDS SYSTEM ERRORS =====
35    #[error("The oracle signature is invalid")]
36    InvalidOracleSignature = 13,
37    #[error("The proof length exceeds the maximum allowed limit")]
38    ProofLengthExceeded = 14,
39    #[error("The social rewards pool has insufficient funds")]
40    InsufficientRewardsPool = 15,
41    // ===== DUAL MERKLE TREE SYSTEM ERRORS =====
42    #[error("The payment merkle proof is invalid")]
43    InvalidPaymentProof = 16,
44    #[error("The seal merkle proof is invalid")]
45    InvalidSealProof = 17,
46    #[error("The claim for this epoch has already been processed")]
47    ClaimAlreadyProcessed = 18,
48    // ===== EPOCH HASH CHAIN SECURITY ERRORS =====
49    #[error("The epoch hash validation failed - oracle submission mismatch")]
50    InvalidEpochHash = 19,
51    // ===== ORACLE AUTHORITY MANAGEMENT ERRORS =====
52    #[error("The oracle authority is unchanged")]
53    OracleAuthorityUnchanged = 20,
54
55    // ===== EPOCH UPDATE CONTEXT ERRORS (specific to UpdateSnapshot instruction) =====
56    #[error("Epoch is too far in the past for snapshot update (epoch sequence validation failed)")]
57    UpdateSnapshotEpochTooOld = 21,
58
59    #[error("Epoch is in the future and cannot be updated")]
60    UpdateSnapshotEpochInFuture = 22,
61
62    #[error("Epoch snapshot data already exists")]
63    UpdateSnapshotEpochAlreadyExists = 23,
64
65    #[error("Hash chain validation failed during snapshot update")]
66    UpdateSnapshotHashChainValidationFailed = 24,
67
68    // ===== RESET INSTRUCTION ERRORS =====
69    #[error("Reset can only be performed once per epoch")]
70    ResetAlreadyPerformedForEpoch = 25,
71
72    #[error("Reset can only be performed for current or future epochs")]
73    ResetEpochTooOld = 26,
74
75    // ===== EPOCH SEQUENCE VALIDATION ERRORS =====
76    #[error("Epoch updates must be sequential - cannot skip epochs or update out of order")]
77    UpdateSnapshotEpochOutOfSequence = 27,
78
79    // ===== HISTORICAL EPOCH CLAIM VALIDATION ERRORS =====
80    #[error("Epoch is too old for claim (beyond 1 year limit)")]
81    EpochTooOld = 28,
82
83    #[error("Epoch is in the future and cannot be claimed")]
84    EpochInFuture = 29,
85}
86
87error!(MiracleError);