@@ -15,8 +15,11 @@ use authority_selection_inherents::{
1515 AuthoritySelectionInputs , CommitteeMember , PermissionedCandidateDataError ,
1616 RegistrationDataError , StakeError , select_authorities, validate_permissioned_candidate_data,
1717} ;
18+ use frame_support:: dynamic_params:: { dynamic_pallet_params, dynamic_params} ;
1819use frame_support:: genesis_builder_helper:: { build_state, get_preset} ;
1920use frame_support:: inherent:: ProvideInherent ;
21+ use frame_support:: traits:: LinearStoragePrice ;
22+ use frame_support:: traits:: fungible:: HoldConsideration ;
2023use frame_support:: weights:: constants:: RocksDbWeight as RuntimeDbWeight ;
2124use frame_support:: {
2225 BoundedVec , construct_runtime, parameter_types,
@@ -294,6 +297,10 @@ impl pallet_timestamp::Config for Runtime {
294297
295298/// Existential deposit.
296299pub const EXISTENTIAL_DEPOSIT : u128 = 500 ;
300+ pub const UNITS : Balance = 1_000_000_000_000 ;
301+ pub const fn deposit ( items : u32 , bytes : u32 ) -> Balance {
302+ items as Balance * UNITS + ( bytes as Balance ) * UNITS / 10
303+ }
297304
298305impl pallet_balances:: Config for Runtime {
299306 type MaxLocks = ConstU32 < 50 > ;
@@ -648,6 +655,71 @@ impl pallet_partner_chains_bridge::Config for Runtime {
648655 type BenchmarkHelper = ( ) ;
649656}
650657
658+ impl pallet_parameters:: Config for Runtime {
659+ type RuntimeEvent = RuntimeEvent ;
660+ type RuntimeParameters = RuntimeParameters ;
661+ type AdminOrigin = EnsureRoot < AccountId > ;
662+ type WeightInfo = ( ) ;
663+ }
664+
665+ parameter_types ! {
666+ pub MaximumSchedulerWeight : Weight = Perbill :: from_percent( 80 ) *
667+ BlockWeights :: get( ) . max_block;
668+ pub const MaxScheduledPerBlock : u32 = 50 ;
669+ }
670+
671+ impl pallet_scheduler:: Config for Runtime {
672+ type RuntimeOrigin = RuntimeOrigin ;
673+ type RuntimeEvent = RuntimeEvent ;
674+ type PalletsOrigin = OriginCaller ;
675+ type RuntimeCall = RuntimeCall ;
676+ type MaximumWeight = MaximumSchedulerWeight ;
677+ type ScheduleOrigin = EnsureRoot < AccountId > ;
678+ type MaxScheduledPerBlock = MaxScheduledPerBlock ;
679+ type WeightInfo = ( ) ;
680+ type OriginPrivilegeCmp = frame_support:: traits:: EqualPrivilegeOnly ;
681+ type Preimages = Preimage ;
682+ type BlockNumberProvider = frame_system:: Pallet < Runtime > ;
683+ }
684+
685+ parameter_types ! {
686+ pub const PreimageHoldReason : RuntimeHoldReason = RuntimeHoldReason :: Preimage ( pallet_preimage:: HoldReason :: Preimage ) ;
687+ }
688+
689+ impl pallet_preimage:: Config for Runtime {
690+ type WeightInfo = ( ) ;
691+ type RuntimeEvent = RuntimeEvent ;
692+ type Currency = Balances ;
693+ type ManagerOrigin = EnsureRoot < AccountId > ;
694+ type Consideration = HoldConsideration <
695+ AccountId ,
696+ Balances ,
697+ PreimageHoldReason ,
698+ LinearStoragePrice <
699+ dynamic_params:: preimage:: BaseDeposit ,
700+ dynamic_params:: preimage:: ByteDeposit ,
701+ Balance ,
702+ > ,
703+ > ;
704+ }
705+
706+ #[ dynamic_params( RuntimeParameters , pallet_parameters:: Parameters :: <Runtime >) ]
707+ pub mod dynamic_params {
708+ use super :: * ;
709+
710+ #[ dynamic_pallet_params]
711+ #[ codec( index = 0 ) ]
712+ pub mod preimage {
713+ use super :: * ;
714+
715+ #[ codec( index = 0 ) ]
716+ pub static BaseDeposit : Balance = deposit ( 2 , 64 ) ;
717+
718+ #[ codec( index = 1 ) ]
719+ pub static ByteDeposit : Balance = deposit ( 0 , 1 ) ;
720+ }
721+ }
722+
651723// Create the runtime by composing the FRAME pallets that were previously configured.
652724construct_runtime ! (
653725 pub struct Runtime {
@@ -674,6 +746,9 @@ construct_runtime!(
674746 Session : pallet_session exclude_parts { Call } ,
675747 GovernedMap : pallet_governed_map,
676748 Bridge : pallet_partner_chains_bridge,
749+ Parameters : pallet_parameters,
750+ Preimage : pallet_preimage,
751+ Scheduler : pallet_scheduler,
677752 TestHelperPallet : crate :: test_helper_pallet,
678753 }
679754) ;
0 commit comments