feat: Add mechanism to check era's features (#120)
This commit is contained in:
parent
00c9e1835e
commit
a4840b5ae3
2 changed files with 27 additions and 0 deletions
17
pallas-traverse/src/era.rs
Normal file
17
pallas-traverse/src/era.rs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
use crate::{Era, Feature};
|
||||
|
||||
impl Era {
|
||||
#[allow(clippy::match_like_matches_macro)]
|
||||
pub fn has_feature(&self, feature: Feature) -> bool {
|
||||
match (self, feature) {
|
||||
(Era::Byron, _) => false,
|
||||
(Era::Shelley, Feature::SmartContracts) => false,
|
||||
(Era::Shelley, Feature::TimeLocks) => false,
|
||||
(Era::Shelley, Feature::MultiAssets) => false,
|
||||
(Era::Allegra, Feature::MultiAssets) => false,
|
||||
(Era::Allegra, Feature::SmartContracts) => false,
|
||||
(Era::Mary, Feature::SmartContracts) => false,
|
||||
_ => true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -8,6 +8,7 @@ use thiserror::Error;
|
|||
|
||||
pub mod block;
|
||||
pub mod cert;
|
||||
pub mod era;
|
||||
pub mod output;
|
||||
pub mod probe;
|
||||
mod support;
|
||||
|
|
@ -23,6 +24,15 @@ pub enum Era {
|
|||
Alonzo, // smart-contracts
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
|
||||
#[non_exhaustive]
|
||||
pub enum Feature {
|
||||
TimeLocks,
|
||||
MultiAssets,
|
||||
Staking,
|
||||
SmartContracts,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[non_exhaustive]
|
||||
pub enum MultiEraBlock<'b> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue