@@ -503,7 +503,6 @@ pub mod pallet {
503
503
pub type Safeguard < T : Config > = StorageValue < _ , bool , ValueQuery , DefaultSafeguard < T > > ;
504
504
505
505
#[ pallet:: genesis_config]
506
- #[ derive( frame_support:: DefaultNoBound , PartialEq ) ]
507
506
pub struct GenesisConfig < T > {
508
507
pub reward_portion : Vec < Permill > ,
509
508
pub slot_distribution : Vec < Permill > ,
@@ -513,15 +512,28 @@ pub mod pallet {
513
512
pub _config : PhantomData < T > ,
514
513
}
515
514
515
+ impl < T : Config > Default for GenesisConfig < T > {
516
+ fn default ( ) -> Self {
517
+ use sp_std:: vec;
518
+ let num_tiers = T :: NumberOfTiers :: get ( ) ;
519
+ Self {
520
+ reward_portion : vec ! [ Permill :: from_percent( 100 / num_tiers) ; num_tiers as usize ] ,
521
+ slot_distribution : vec ! [ Permill :: from_percent( 100 / num_tiers) ; num_tiers as usize ] ,
522
+ tier_thresholds : ( 0 ..num_tiers)
523
+ . map ( |i| TierThreshold :: FixedTvlAmount {
524
+ amount : ( 10 * i) . into ( ) ,
525
+ } )
526
+ . collect ( ) ,
527
+ slots_per_tier : vec ! [ 100 ; num_tiers as usize ] ,
528
+ safeguard : None ,
529
+ _config : Default :: default ( ) ,
530
+ }
531
+ }
532
+ }
533
+
516
534
#[ pallet:: genesis_build]
517
535
impl < T : Config > BuildGenesisConfig for GenesisConfig < T > {
518
536
fn build ( & self ) {
519
- if self == & Default :: default ( ) {
520
- // Default config is an empty config, no build is needed
521
- // Remove this is default genesis changes
522
- return ;
523
- }
524
-
525
537
// Prepare tier parameters & verify their correctness
526
538
let tier_params = TierParameters :: < T :: NumberOfTiers > {
527
539
reward_portion : BoundedVec :: < Permill , T :: NumberOfTiers > :: try_from (
0 commit comments