miracle-api 0.6.0

Miracle is a pay2e protocol for sovereign individuals living in Mirascape Horizon.
Documentation
use steel::*;

#[derive(Debug, Error, Clone, Copy, PartialEq, Eq, IntoPrimitive)]
#[repr(u32)]
pub enum MiracleError {
    #[error("The maximum supply has been reached")]
    MaxSupply = 0,
    #[error("The starting time has not passed yet")]
    NotStarted = 1,
    #[error("Here we are, it's been a long journey, the Miracle Rewards Mission has finally come to an end.")]
    HasEnded = 2,
    // ===== PAYMENT-BASED REWARDS SYSTEM ERRORS =====
    #[error("The epoch is invalid or out of range")]
    InvalidEpoch = 3,
    #[error("The oracle authority is invalid")]
    InvalidOracleAuthority = 4,
    #[error("The claim amount exceeds available rewards")]
    ClaimAmountExceedsRewards = 5,
    #[error("The claim amount exceeds threshold")]
    ClaimAmountExceedsThreshold = 6,
    #[error("The input parameters are invalid")]
    InvalidInput = 7,
    // ===== ENHANCED COMMUNITY METRICS VALIDATION ERRORS =====
    #[error("The weights do not sum to 10000 (100%)")]
    InvalidWeights = 8,
    #[error("The retention rate is out of bounds (must be 0-10000)")]
    InvalidRetentionRate = 9,
    #[error("The community metrics calculation failed")]
    MetricsCalculationFailed = 10,
    #[error("The customer/merchant reward split is invalid (must sum to 10000)")]
    InvalidRewardSplit = 11,
    #[error("The activity count is out of bounds (must be 0-1,000,000)")]
    InvalidActivityCount = 12,
    // ===== SOCIAL MARKETING REWARDS SYSTEM ERRORS =====
    #[error("The oracle signature is invalid")]
    InvalidOracleSignature = 13,
    #[error("The proof length exceeds the maximum allowed limit")]
    ProofLengthExceeded = 14,
    #[error("The social rewards pool has insufficient funds")]
    InsufficientRewardsPool = 15,
    // ===== DUAL MERKLE TREE SYSTEM ERRORS =====
    #[error("The payment merkle proof is invalid")]
    InvalidPaymentProof = 16,
    #[error("The seal merkle proof is invalid")]
    InvalidSealProof = 17,
    #[error("The claim for this epoch has already been processed")]
    ClaimAlreadyProcessed = 18,
    // ===== EPOCH HASH CHAIN SECURITY ERRORS =====
    #[error("The epoch hash validation failed - oracle submission mismatch")]
    InvalidEpochHash = 19,
    // ===== ORACLE AUTHORITY MANAGEMENT ERRORS =====
    #[error("The oracle authority is unchanged")]
    OracleAuthorityUnchanged = 20,

    // ===== EPOCH UPDATE CONTEXT ERRORS (specific to UpdateSnapshot instruction) =====
    #[error("Epoch is too far in the past for snapshot update (epoch sequence validation failed)")]
    UpdateSnapshotEpochTooOld = 21,

    #[error("Epoch is in the future and cannot be updated")]
    UpdateSnapshotEpochInFuture = 22,

    #[error("Epoch snapshot data already exists")]
    UpdateSnapshotEpochAlreadyExists = 23,

    #[error("Hash chain validation failed during snapshot update")]
    UpdateSnapshotHashChainValidationFailed = 24,

    // ===== RESET INSTRUCTION ERRORS =====
    #[error("Reset can only be performed once per epoch")]
    ResetAlreadyPerformedForEpoch = 25,

    #[error("Reset can only be performed for current or future epochs")]
    ResetEpochTooOld = 26,

    // ===== EPOCH SEQUENCE VALIDATION ERRORS =====
    #[error("Epoch updates must be sequential - cannot skip epochs or update out of order")]
    UpdateSnapshotEpochOutOfSequence = 27,

    // ===== HISTORICAL EPOCH CLAIM VALIDATION ERRORS =====
    #[error("Epoch is too old for claim (beyond 1 year limit)")]
    EpochTooOld = 28,

    #[error("Epoch is in the future and cannot be claimed")]
    EpochInFuture = 29,
}

error!(MiracleError);