pub trait MainchainEpochDerivation {
// Required methods
fn epochs_passed(
&self,
timestamp: Timestamp,
) -> Result<u32, EpochDerivationError>;
fn timestamp_to_mainchain_epoch(
&self,
timestamp: Timestamp,
) -> Result<McEpochNumber, EpochDerivationError>;
fn timestamp_to_mainchain_slot_number(
&self,
timestamp: Timestamp,
) -> Result<u64, EpochDerivationError>;
fn mainchain_epoch_to_timestamp(&self, epoch: McEpochNumber) -> Timestamp;
fn first_slot_of_epoch(
&self,
epoch: McEpochNumber,
) -> Result<McSlotNumber, EpochDerivationError>;
fn epoch_for_slot(
&self,
slot: McSlotNumber,
) -> Result<McEpochNumber, EpochDerivationError>;
}
Expand description
Functions for performing calculations on Cardano epoch and slot numbers
Required Methods§
Sourcefn epochs_passed(
&self,
timestamp: Timestamp,
) -> Result<u32, EpochDerivationError>
fn epochs_passed( &self, timestamp: Timestamp, ) -> Result<u32, EpochDerivationError>
Calculates the number of Cardano epochs passed since the first Shelley epoch up to timestamp
Sourcefn timestamp_to_mainchain_epoch(
&self,
timestamp: Timestamp,
) -> Result<McEpochNumber, EpochDerivationError>
fn timestamp_to_mainchain_epoch( &self, timestamp: Timestamp, ) -> Result<McEpochNumber, EpochDerivationError>
Calculates the number of the Cardano epoch containing timestamp
Sourcefn timestamp_to_mainchain_slot_number(
&self,
timestamp: Timestamp,
) -> Result<u64, EpochDerivationError>
fn timestamp_to_mainchain_slot_number( &self, timestamp: Timestamp, ) -> Result<u64, EpochDerivationError>
Calculates the number of the Cardano slot containing timestamp
Sourcefn mainchain_epoch_to_timestamp(&self, epoch: McEpochNumber) -> Timestamp
fn mainchain_epoch_to_timestamp(&self, epoch: McEpochNumber) -> Timestamp
Calculates the starting time of the Cardano epoch
Sourcefn first_slot_of_epoch(
&self,
epoch: McEpochNumber,
) -> Result<McSlotNumber, EpochDerivationError>
fn first_slot_of_epoch( &self, epoch: McEpochNumber, ) -> Result<McSlotNumber, EpochDerivationError>
Calculates the slot number of the first Cardano slot of given epoch
Sourcefn epoch_for_slot(
&self,
slot: McSlotNumber,
) -> Result<McEpochNumber, EpochDerivationError>
fn epoch_for_slot( &self, slot: McSlotNumber, ) -> Result<McEpochNumber, EpochDerivationError>
Calculates the number of the Cardano epoch containing slot