use core::fmt;
use revm::precompile::PrecompileHalt;
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum ReserveBalanceError {
MethodNotSupported,
ValueNonZero,
InvalidInput,
}
impl ReserveBalanceError {
pub fn into_precompile_error(self) -> PrecompileHalt {
match self {
Self::MethodNotSupported => PrecompileHalt::Other("method not supported".into()),
Self::ValueNonZero => PrecompileHalt::Other("value is nonzero".into()),
Self::InvalidInput => PrecompileHalt::Other("input is invalid".into()),
}
}
}
impl fmt::Display for ReserveBalanceError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::MethodNotSupported => f.write_str("method not supported"),
Self::ValueNonZero => f.write_str("value is nonzero"),
Self::InvalidInput => f.write_str("input is invalid"),
}
}
}