pub trait CycleConfiguration {
    // Required methods
    fn periods_per_cycle() -> PeriodNumber;
    fn eras_per_voting_subperiod() -> EraNumber;
    fn eras_per_build_and_earn_subperiod() -> EraNumber;
    fn blocks_per_era() -> BlockNumber;

    // Provided methods
    fn period_in_era_lengths() -> EraNumber { ... }
    fn cycle_in_era_lengths() -> EraNumber { ... }
    fn blocks_per_cycle() -> BlockNumber { ... }
    fn build_and_earn_eras_per_cycle() -> EraNumber { ... }
    fn eras_per_period() -> EraNumber { ... }
    fn eras_per_cycle() -> EraNumber { ... }
}
Expand description

Configuration for cycles, periods, subperiods & eras.

  • cycle - Time unit similar to ‘year’ in the real world. Consists of one or more periods. At the beginning of each cycle, inflation is recalculated.
  • period - Period consists of two distinct subperiods: Voting & Build&Earn. They are integral parts of dApp staking. Length is expressed in standard eras or just eras.
  • era - Era is the basic time unit in the dApp staking protocol. At the end of each era, reward pools for stakers & dApps are calculated. Era length is expressed in blocks.

Required Methods§

source

fn periods_per_cycle() -> PeriodNumber

How many different periods are there in a cycle (a ‘year’).

This value has to be at least 1.

source

fn eras_per_voting_subperiod() -> EraNumber

For how many standard era lengths does the voting subperiod last.

This value has to be at least 1.

source

fn eras_per_build_and_earn_subperiod() -> EraNumber

How many standard eras are there in the build&earn subperiod.

This value has to be at least 1.

source

fn blocks_per_era() -> BlockNumber

How many blocks are there per standard era.

This value has to be at least 1.

Provided Methods§

source

fn period_in_era_lengths() -> EraNumber

For how many standard era lengths does the period last.

source

fn cycle_in_era_lengths() -> EraNumber

For how many standard era lengths does the cycle (a ‘year’) last.

source

fn blocks_per_cycle() -> BlockNumber

How many blocks are there per cycle (a ‘year’).

source

fn build_and_earn_eras_per_cycle() -> EraNumber

For how many standard era lengths do all the build&earn subperiods in a cycle last.

source

fn eras_per_period() -> EraNumber

How many distinct eras are there in a single period.

source

fn eras_per_cycle() -> EraNumber

How many distinct eras are there in a cycle.

Object Safety§

This trait is not object safe.

Implementors§