1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
use super::*;
use sp_arithmetic::traits::BaseArithmetic;
use sp_std::marker::PhantomData;
pub trait ComputeEraWithParam<EraIndex> {
type Param;
fn compute(era: &EraIndex) -> Self::Param;
}
pub struct DefaultForDappsStaking<T: Trait> {
_phantom: PhantomData<T>,
}
impl<T: Trait> ComputeEraWithParam<EraIndex> for DefaultForDappsStaking<T> {
type Param = BalanceOf<T>;
fn compute(_era: &EraIndex) -> BalanceOf<T> {
0.into()
}
}
pub trait ComputeTotalPayout<ValidatorParam, DappsParam> {
fn compute<N, M>(
total_tokens: N,
era_duration: M,
for_security_parm: ValidatorParam,
for_dapps_param: DappsParam,
) -> (N, N)
where
N: BaseArithmetic + num_traits::sign::Unsigned + Clone + From<u32>,
M: BaseArithmetic + Clone + From<u32>;
}
pub trait MaybeValidators<EraIndex, AccountId> {
fn compute(current_era: EraIndex) -> Option<Vec<AccountId>>;
}
pub trait EraFinder<EraIndex, SessionIndex, Moment> {
fn current() -> Option<EraIndex>;
fn active() -> Option<ActiveEraInfo<Moment>>;
fn start_session_index(era: &EraIndex) -> Option<SessionIndex>;
}
pub trait ForSecurityEraRewardFinder<Balance> {
fn get(era: &EraIndex) -> Option<Balance>;
}
pub trait ForDappsEraRewardFinder<Balance> {
fn get(era: &EraIndex) -> Option<Balance>;
}
pub trait HistoryDepthFinder {
fn get() -> u32;
}