diff --git a/runtime/common/src/pallets_config.rs b/runtime/common/src/pallets_config.rs index b694409073f69d3afd6682b09117132abf910387..f9bf0f1ce207f2f7277ae3dc3aef4b74720c584c 100644 --- a/runtime/common/src/pallets_config.rs +++ b/runtime/common/src/pallets_config.rs @@ -176,8 +176,6 @@ macro_rules! pallets_config { type WeightInfo = weights::pallet_balances::WeightInfo<Runtime>; } - pub struct OnChargeTransaction; - parameter_types! { pub Target: Perquintill = Perquintill::from_percent(25); pub MaxMultiplier: sp_runtime::FixedU128 = 10.into(); @@ -411,19 +409,12 @@ macro_rules! pallets_config { // UNIVERSAL DIVIDEND // - pub struct MembersCount; - impl frame_support::pallet_prelude::Get<Balance> for MembersCount { - fn get() -> Balance { - <Membership as sp_membership::traits::MembersCount>::members_count() as Balance - } - } - impl pallet_universal_dividend::Config for Runtime { type Currency = Balances; #[cfg(feature = "runtime-benchmarks")] type IdtyAttr = Identity; type MaxPastReeval = frame_support::traits::ConstU32<160>; - type MembersCount = MembersCount; + type MembersCount = common_runtime::providers::MembersCount<Membership>; type MembersStorage = common_runtime::providers::UdMembersStorage<Runtime>; type MomentIntoBalance = sp_runtime::traits::ConvertInto; type RuntimeEvent = RuntimeEvent; diff --git a/runtime/common/src/providers.rs b/runtime/common/src/providers.rs index 829be1a07e64d033fd9f68b85c31db1f0612a670..848ebec9a072f4fdf28c393c267caa065b743285 100644 --- a/runtime/common/src/providers.rs +++ b/runtime/common/src/providers.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU Affero General Public License // along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>. -use crate::{entities::IdtyData, AccountId, IdtyIndex}; +use crate::{entities::IdtyData, AccountId, Balance, IdtyIndex}; use core::marker::PhantomData; use pallet_universal_dividend::FirstEligibleUd; @@ -116,3 +116,13 @@ macro_rules! impl_benchmark_setup_handler { #[cfg(feature = "runtime-benchmarks")] impl_benchmark_setup_handler!(pallet_membership::SetupBenchmark<<T as pallet_identity::Config>::IdtyIndex, T::AccountId>); + +pub struct MembersCount<T>(PhantomData<T>); +impl<T> frame_support::pallet_prelude::Get<Balance> for MembersCount<T> +where + T: sp_membership::traits::MembersCount, +{ + fn get() -> Balance { + T::members_count() as Balance + } +}