mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 09:21:04 +00:00
Rename pallet trait Trait to Config (#7599)
* rename Trait to Config * add test asserting using Trait is still valid. * fix ui tests
This commit is contained in:
committed by
GitHub
parent
dd3c84c362
commit
1cbfc9257f
@@ -77,7 +77,7 @@
|
||||
//!
|
||||
//! ### Module Information
|
||||
//!
|
||||
//! - [`election_sp_phragmen::Trait`](./trait.Trait.html)
|
||||
//! - [`election_sp_phragmen::Config`](./trait.Config.html)
|
||||
//! - [`Call`](./enum.Call.html)
|
||||
//! - [`Module`](./struct.Module.html)
|
||||
|
||||
@@ -112,9 +112,9 @@ pub use weights::WeightInfo;
|
||||
pub const MAXIMUM_VOTE: usize = 16;
|
||||
|
||||
type BalanceOf<T> =
|
||||
<<T as Trait>::Currency as Currency<<T as frame_system::Trait>::AccountId>>::Balance;
|
||||
<<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance;
|
||||
type NegativeImbalanceOf<T> =
|
||||
<<T as Trait>::Currency as Currency<<T as frame_system::Trait>::AccountId>>::NegativeImbalance;
|
||||
<<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::NegativeImbalance;
|
||||
|
||||
/// An indication that the renouncing account currently has which of the below roles.
|
||||
#[derive(Encode, Decode, Clone, PartialEq, RuntimeDebug)]
|
||||
@@ -140,9 +140,9 @@ pub struct DefunctVoter<AccountId> {
|
||||
pub candidate_count: u32
|
||||
}
|
||||
|
||||
pub trait Trait: frame_system::Trait {
|
||||
pub trait Config: frame_system::Config {
|
||||
/// The overarching event type.c
|
||||
type Event: From<Event<Self>> + Into<<Self as frame_system::Trait>::Event>;
|
||||
type Event: From<Event<Self>> + Into<<Self as frame_system::Config>::Event>;
|
||||
|
||||
/// Identifier for the elections-phragmen pallet's lock
|
||||
type ModuleId: Get<LockIdentifier>;
|
||||
@@ -193,7 +193,7 @@ pub trait Trait: frame_system::Trait {
|
||||
}
|
||||
|
||||
decl_storage! {
|
||||
trait Store for Module<T: Trait> as PhragmenElection {
|
||||
trait Store for Module<T: Config> as PhragmenElection {
|
||||
// ---- State
|
||||
/// The current elected membership. Sorted based on account id.
|
||||
pub Members get(fn members): Vec<(T::AccountId, BalanceOf<T>)>;
|
||||
@@ -251,7 +251,7 @@ decl_storage! {
|
||||
}
|
||||
|
||||
decl_error! {
|
||||
pub enum Error for Module<T: Trait> {
|
||||
pub enum Error for Module<T: Config> {
|
||||
/// Cannot vote when no candidates or members exist.
|
||||
UnableToVote,
|
||||
/// Must vote for at least one candidate.
|
||||
@@ -290,7 +290,7 @@ decl_error! {
|
||||
}
|
||||
|
||||
decl_module! {
|
||||
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
|
||||
pub struct Module<T: Config> for enum Call where origin: T::Origin {
|
||||
type Error = Error<T>;
|
||||
|
||||
fn deposit_event() = default;
|
||||
@@ -667,7 +667,7 @@ decl_module! {
|
||||
decl_event!(
|
||||
pub enum Event<T> where
|
||||
Balance = BalanceOf<T>,
|
||||
<T as frame_system::Trait>::AccountId,
|
||||
<T as frame_system::Config>::AccountId,
|
||||
{
|
||||
/// A new term with \[new_members\]. This indicates that enough candidates existed to run the
|
||||
/// election, not that enough have has been elected. The inner value must be examined for
|
||||
@@ -694,7 +694,7 @@ decl_event!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<T: Trait> Module<T> {
|
||||
impl<T: Config> Module<T> {
|
||||
/// Attempts to remove a member `who`. If a runner-up exists, it is used as the replacement and
|
||||
/// Ok(true). is returned.
|
||||
///
|
||||
@@ -1027,7 +1027,7 @@ impl<T: Trait> Module<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Trait> Contains<T::AccountId> for Module<T> {
|
||||
impl<T: Config> Contains<T::AccountId> for Module<T> {
|
||||
fn contains(who: &T::AccountId) -> bool {
|
||||
Self::is_member(who)
|
||||
}
|
||||
@@ -1046,7 +1046,7 @@ impl<T: Trait> Contains<T::AccountId> for Module<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Trait> ContainsLengthBound for Module<T> {
|
||||
impl<T: Config> ContainsLengthBound for Module<T> {
|
||||
fn min_len() -> usize { 0 }
|
||||
|
||||
/// Implementation uses a parameter type so calling is cost-free.
|
||||
@@ -1076,7 +1076,7 @@ mod tests {
|
||||
pub const AvailableBlockRatio: Perbill = Perbill::one();
|
||||
}
|
||||
|
||||
impl frame_system::Trait for Test {
|
||||
impl frame_system::Config for Test {
|
||||
type BaseCallFilter = ();
|
||||
type Origin = Origin;
|
||||
type Index = u64;
|
||||
@@ -1108,7 +1108,7 @@ mod tests {
|
||||
pub const ExistentialDeposit: u64 = 1;
|
||||
}
|
||||
|
||||
impl pallet_balances::Trait for Test {
|
||||
impl pallet_balances::Config for Test {
|
||||
type Balance = u64;
|
||||
type Event = Event;
|
||||
type DustRemoval = ();
|
||||
@@ -1175,7 +1175,7 @@ mod tests {
|
||||
pub const ElectionsPhragmenModuleId: LockIdentifier = *b"phrelect";
|
||||
}
|
||||
|
||||
impl Trait for Test {
|
||||
impl Config for Test {
|
||||
type ModuleId = ElectionsPhragmenModuleId;
|
||||
type Event = Event;
|
||||
type Currency = Balances;
|
||||
|
||||
Reference in New Issue
Block a user