-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathfee.rs
More file actions
45 lines (39 loc) · 1.39 KB
/
fee.rs
File metadata and controls
45 lines (39 loc) · 1.39 KB
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
use core::marker::PhantomData;
use codec::{Decode, Encode, MaxEncodedLen};
use polkadot_sdk::{
frame_election_provider_support::Get, frame_support::DebugNoBound, sp_runtime::Percent,
};
use scale_info::TypeInfo;
#[derive(DebugNoBound, Decode, Encode, MaxEncodedLen, PartialEq, Eq, TypeInfo)]
#[scale_info(skip_type_params(T))]
pub struct ValidatorFeeConstraints<T: crate::Config> {
pub min_staking_fee: Percent,
pub min_weight_control_fee: Percent,
pub _pd: PhantomData<T>,
}
impl<T: crate::Config> Default for ValidatorFeeConstraints<T> {
fn default() -> Self {
Self {
min_staking_fee: Percent::from_percent(T::DefaultMinStakingFee::get()),
min_weight_control_fee: Percent::from_percent(T::DefaultMinWeightControlFee::get()),
_pd: PhantomData,
}
}
}
#[derive(DebugNoBound, Decode, Encode, MaxEncodedLen, PartialEq, Eq, TypeInfo)]
#[scale_info(skip_type_params(T))]
pub struct ValidatorFee<T: crate::Config> {
pub staking_fee: Percent,
pub weight_control_fee: Percent,
pub _pd: PhantomData<T>,
}
impl<T: crate::Config> Default for ValidatorFee<T> {
fn default() -> Self {
let fee_constraints = crate::FeeConstraints::<T>::get();
Self {
staking_fee: fee_constraints.min_staking_fee,
weight_control_fee: fee_constraints.min_weight_control_fee,
_pd: PhantomData,
}
}
}