mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-15 17:21:08 +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
@@ -30,9 +30,9 @@ use frame_support::{
|
||||
};
|
||||
use frame_system::ensure_signed;
|
||||
|
||||
pub trait Trait<I=DefaultInstance>: frame_system::Trait {
|
||||
pub trait Config<I=DefaultInstance>: frame_system::Config {
|
||||
/// The overarching event type.
|
||||
type Event: From<Event<Self, I>> + Into<<Self as frame_system::Trait>::Event>;
|
||||
type Event: From<Event<Self, I>> + Into<<Self as frame_system::Config>::Event>;
|
||||
|
||||
/// Required origin for adding a member (though can always be Root).
|
||||
type AddOrigin: EnsureOrigin<Self::Origin>;
|
||||
@@ -59,7 +59,7 @@ pub trait Trait<I=DefaultInstance>: frame_system::Trait {
|
||||
}
|
||||
|
||||
decl_storage! {
|
||||
trait Store for Module<T: Trait<I>, I: Instance=DefaultInstance> as Membership {
|
||||
trait Store for Module<T: Config<I>, I: Instance=DefaultInstance> as Membership {
|
||||
/// The current membership, stored as an ordered Vec.
|
||||
Members get(fn members): Vec<T::AccountId>;
|
||||
|
||||
@@ -80,8 +80,8 @@ decl_storage! {
|
||||
|
||||
decl_event!(
|
||||
pub enum Event<T, I=DefaultInstance> where
|
||||
<T as frame_system::Trait>::AccountId,
|
||||
<T as Trait<I>>::Event,
|
||||
<T as frame_system::Config>::AccountId,
|
||||
<T as Config<I>>::Event,
|
||||
{
|
||||
/// The given member was added; see the transaction for who.
|
||||
MemberAdded,
|
||||
@@ -100,7 +100,7 @@ decl_event!(
|
||||
|
||||
decl_error! {
|
||||
/// Error for the nicks module.
|
||||
pub enum Error for Module<T: Trait<I>, I: Instance> {
|
||||
pub enum Error for Module<T: Config<I>, I: Instance> {
|
||||
/// Already a member.
|
||||
AlreadyMember,
|
||||
/// Not a member.
|
||||
@@ -109,7 +109,7 @@ decl_error! {
|
||||
}
|
||||
|
||||
decl_module! {
|
||||
pub struct Module<T: Trait<I>, I: Instance=DefaultInstance>
|
||||
pub struct Module<T: Config<I>, I: Instance=DefaultInstance>
|
||||
for enum Call
|
||||
where origin: T::Origin
|
||||
{
|
||||
@@ -253,7 +253,7 @@ decl_module! {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Trait<I>, I: Instance> Module<T, I> {
|
||||
impl<T: Config<I>, I: Instance> Module<T, I> {
|
||||
fn rejig_prime(members: &[T::AccountId]) {
|
||||
if let Some(prime) = Prime::<T, I>::get() {
|
||||
match members.binary_search(&prime) {
|
||||
@@ -264,7 +264,7 @@ impl<T: Trait<I>, I: Instance> Module<T, I> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Trait<I>, I: Instance> Contains<T::AccountId> for Module<T, I> {
|
||||
impl<T: Config<I>, I: Instance> Contains<T::AccountId> for Module<T, I> {
|
||||
fn sorted_members() -> Vec<T::AccountId> {
|
||||
Self::members()
|
||||
}
|
||||
@@ -300,7 +300,7 @@ mod tests {
|
||||
pub static Members: Vec<u64> = vec![];
|
||||
pub static Prime: Option<u64> = None;
|
||||
}
|
||||
impl frame_system::Trait for Test {
|
||||
impl frame_system::Config for Test {
|
||||
type BaseCallFilter = ();
|
||||
type Origin = Origin;
|
||||
type Index = u64;
|
||||
@@ -359,7 +359,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
impl Trait for Test {
|
||||
impl Config for Test {
|
||||
type Event = ();
|
||||
type AddOrigin = EnsureSignedBy<One, u64>;
|
||||
type RemoveOrigin = EnsureSignedBy<Two, u64>;
|
||||
|
||||
Reference in New Issue
Block a user