Commit 214cc867 authored by Éloïs's avatar Éloïs
Browse files

ref(runtime): move UdAccountsProvider in common part

parent 26c5ce89
......@@ -23,6 +23,7 @@ pub mod entities;
pub mod fees;
pub mod handlers;
mod pallets_config;
pub mod providers;
pub use sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic;
......
......@@ -146,8 +146,8 @@ macro_rules! pallets_config {
impl pallet_universal_dividend::Config for Runtime {
type Currency = pallet_balances::Pallet<Runtime>;
type Event = Event;
type MembersCount = UdAccountsProvider;
type MembersIds = UdAccountsProvider;
type MembersCount = common_runtime::providers::UdAccountsProvider<Runtime>;
type MembersIds = common_runtime::providers::UdAccountsProvider<Runtime>;
type SquareMoneyGrowthRate = SquareMoneyGrowthRate;
type UdCreationPeriod = UdCreationPeriod;
type UdReevalPeriod = UdReevalPeriod;
......
// Copyright 2021 Axiom-Team
//
// This file is part of Substrate-Libre-Currency.
//
// Substrate-Libre-Currency is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, version 3 of the License.
//
// Substrate-Libre-Currency is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with Substrate-Libre-Currency. If not, see <https://www.gnu.org/licenses/>.
use crate::AccountId;
use frame_support::traits::Get;
use sp_std::vec::Vec;
pub struct UdAccountsProvider<Runtime>(core::marker::PhantomData<Runtime>);
impl<Runtime: pallet_ud_accounts_storage::Config> Get<u64> for UdAccountsProvider<Runtime> {
fn get() -> u64 {
<pallet_ud_accounts_storage::Pallet<Runtime>>::ud_accounts_count()
}
}
impl<Runtime: frame_system::Config<AccountId = AccountId> + pallet_ud_accounts_storage::Config>
Get<Vec<AccountId>> for UdAccountsProvider<Runtime>
{
fn get() -> Vec<AccountId> {
<pallet_ud_accounts_storage::Pallet<Runtime>>::account_list()
}
}
......@@ -46,7 +46,6 @@ use common_runtime::{
OnRightKeyChangeHandler,
},
};
use frame_support::traits::Get;
use frame_system::EnsureRoot;
use pallet_grandpa::fg_primitives;
use pallet_grandpa::{AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList};
......@@ -146,18 +145,6 @@ common_runtime::pallets_config! {
}
}
pub struct UdAccountsProvider;
impl Get<u64> for UdAccountsProvider {
fn get() -> u64 {
UdAccountsStorage::ud_accounts_count()
}
}
impl Get<Vec<AccountId>> for UdAccountsProvider {
fn get() -> Vec<AccountId> {
UdAccountsStorage::account_list()
}
}
// Create the runtime by composing the FRAME pallets that were previously configured.
construct_runtime!(
pub enum Runtime where
......
......@@ -45,7 +45,6 @@ use common_runtime::{
OnRightKeyChangeHandler,
},
};
use frame_support::traits::Get;
use frame_system::EnsureRoot;
use pallet_grandpa::fg_primitives;
use pallet_grandpa::{AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList};
......@@ -135,18 +134,6 @@ common_runtime::pallets_config! {
}
}
pub struct UdAccountsProvider;
impl Get<u64> for UdAccountsProvider {
fn get() -> u64 {
UdAccountsStorage::ud_accounts_count()
}
}
impl Get<Vec<AccountId>> for UdAccountsProvider {
fn get() -> Vec<AccountId> {
UdAccountsStorage::account_list()
}
}
// Create the runtime by composing the FRAME pallets that were previously configured.
construct_runtime!(
pub enum Runtime where
......
......@@ -46,7 +46,6 @@ use common_runtime::{
OnRightKeyChangeHandler,
},
};
use frame_support::traits::Get;
use frame_system::EnsureRoot;
use pallet_grandpa::fg_primitives;
use pallet_grandpa::{AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList};
......@@ -146,18 +145,6 @@ common_runtime::pallets_config! {
}
}
pub struct UdAccountsProvider;
impl Get<u64> for UdAccountsProvider {
fn get() -> u64 {
UdAccountsStorage::ud_accounts_count()
}
}
impl Get<Vec<AccountId>> for UdAccountsProvider {
fn get() -> Vec<AccountId> {
UdAccountsStorage::account_list()
}
}
// Create the runtime by composing the FRAME pallets that were previously configured.
construct_runtime!(
pub enum Runtime where
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment