use crate::BatchId;
use alloy_primitives::Address;
use thiserror::Error;
#[derive(Debug, Clone, PartialEq, Eq, Error)]
pub enum StampError {
#[error("owner mismatch: expected {expected}, got {actual}")]
OwnerMismatch {
expected: Address,
actual: Address,
},
#[error("invalid index: index exceeds batch capacity")]
InvalidIndex,
#[error("bucket mismatch: chunk address doesn't belong to stamp bucket")]
BucketMismatch,
#[error("batch not found: {0}")]
BatchNotFound(BatchId),
#[error(
"batch not usable: created at block {created}, current block {current}, need {threshold} confirmations"
)]
BatchNotUsable {
created: u64,
current: u64,
threshold: u64,
},
#[error("batch expired: value {value} <= total_amount {total_amount}")]
BatchExpired {
value: u128,
total_amount: u128,
},
#[error("invalid stamp data: {0}")]
InvalidData(&'static str),
#[error("bucket full: bucket {bucket} has reached capacity {capacity}")]
BucketFull {
bucket: u32,
capacity: u32,
},
#[error("invalid signature")]
InvalidSignature,
}