Skip to content

Commit 9586970

Browse files
authored
Rename pallet trait Trait to Config (#7599)
* rename Trait to Config * add test asserting using Trait is still valid. * fix ui tests
1 parent 5debfce commit 9586970

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

src/lib.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
//! # Society Module
1919
//!
20-
//! - [`society::Trait`](./trait.Trait.html)
20+
//! - [`society::Config`](./trait.Config.html)
2121
//! - [`Call`](./enum.Call.html)
2222
//!
2323
//! ## Overview
@@ -268,13 +268,13 @@ use frame_support::traits::{
268268
};
269269
use frame_system::{self as system, ensure_signed, ensure_root};
270270

271-
type BalanceOf<T, I> = <<T as Trait<I>>::Currency as Currency<<T as system::Trait>::AccountId>>::Balance;
272-
type NegativeImbalanceOf<T> = <<T as Trait>::Currency as Currency<<T as frame_system::Trait>::AccountId>>::NegativeImbalance;
271+
type BalanceOf<T, I> = <<T as Config<I>>::Currency as Currency<<T as system::Config>::AccountId>>::Balance;
272+
type NegativeImbalanceOf<T> = <<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::NegativeImbalance;
273273

274274
/// The module's configuration trait.
275-
pub trait Trait<I=DefaultInstance>: system::Trait {
275+
pub trait Config<I=DefaultInstance>: system::Config {
276276
/// The overarching event type.
277-
type Event: From<Event<Self, I>> + Into<<Self as system::Trait>::Event>;
277+
type Event: From<Event<Self, I>> + Into<<Self as system::Config>::Event>;
278278

279279
/// The societies's module id
280280
type ModuleId: Get<ModuleId>;
@@ -403,7 +403,7 @@ impl<AccountId: PartialEq, Balance> BidKind<AccountId, Balance> {
403403

404404
// This module's storage items.
405405
decl_storage! {
406-
trait Store for Module<T: Trait<I>, I: Instance=DefaultInstance> as Society {
406+
trait Store for Module<T: Config<I>, I: Instance=DefaultInstance> as Society {
407407
/// The first member.
408408
pub Founder get(fn founder) build(|config: &GenesisConfig<T, I>| config.members.first().cloned()):
409409
Option<T::AccountId>;
@@ -472,7 +472,7 @@ decl_storage! {
472472
// The module's dispatchable functions.
473473
decl_module! {
474474
/// The module declaration.
475-
pub struct Module<T: Trait<I>, I: Instance=DefaultInstance> for enum Call where origin: T::Origin {
475+
pub struct Module<T: Config<I>, I: Instance=DefaultInstance> for enum Call where origin: T::Origin {
476476
type Error = Error<T, I>;
477477
/// The minimum amount of a deposit required for a bid to be made.
478478
const CandidateDeposit: BalanceOf<T, I> = T::CandidateDeposit::get();
@@ -1065,7 +1065,7 @@ decl_module! {
10651065

10661066
decl_error! {
10671067
/// Errors for this module.
1068-
pub enum Error for Module<T: Trait<I>, I: Instance> {
1068+
pub enum Error for Module<T: Config<I>, I: Instance> {
10691069
/// An incorrect position was provided.
10701070
BadPosition,
10711071
/// User is not a member.
@@ -1108,7 +1108,7 @@ decl_error! {
11081108
decl_event! {
11091109
/// Events for this module.
11101110
pub enum Event<T, I=DefaultInstance> where
1111-
AccountId = <T as system::Trait>::AccountId,
1111+
AccountId = <T as system::Config>::AccountId,
11121112
Balance = BalanceOf<T, I>
11131113
{
11141114
/// The society is founded by the given identity. \[founder\]
@@ -1151,7 +1151,7 @@ decl_event! {
11511151

11521152
/// Simple ensure origin struct to filter for the founder account.
11531153
pub struct EnsureFounder<T>(sp_std::marker::PhantomData<T>);
1154-
impl<T: Trait> EnsureOrigin<T::Origin> for EnsureFounder<T> {
1154+
impl<T: Config> EnsureOrigin<T::Origin> for EnsureFounder<T> {
11551155
type Success = T::AccountId;
11561156
fn try_origin(o: T::Origin) -> Result<Self::Success, T::Origin> {
11571157
o.into().and_then(|o| match (o, Founder::<T>::get()) {
@@ -1182,7 +1182,7 @@ fn pick_usize<'a, R: RngCore>(rng: &mut R, max: usize) -> usize {
11821182
(rng.next_u32() % (max as u32 + 1)) as usize
11831183
}
11841184

1185-
impl<T: Trait<I>, I: Instance> Module<T, I> {
1185+
impl<T: Config<I>, I: Instance> Module<T, I> {
11861186
/// Puts a bid into storage ordered by smallest to largest value.
11871187
/// Allows a maximum of 1000 bids in queue, removing largest value people first.
11881188
fn put_bid(
@@ -1669,7 +1669,7 @@ impl<T: Trait<I>, I: Instance> Module<T, I> {
16691669
}
16701670
}
16711671

1672-
impl<T: Trait> OnUnbalanced<NegativeImbalanceOf<T>> for Module<T> {
1672+
impl<T: Config> OnUnbalanced<NegativeImbalanceOf<T>> for Module<T> {
16731673
fn on_nonzero_unbalanced(amount: NegativeImbalanceOf<T>) {
16741674
let numeric_amount = amount.peek();
16751675

src/mock.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ ord_parameter_types! {
6060
pub const SuspensionJudgementSetAccount: u128 = 2;
6161
}
6262

63-
impl frame_system::Trait for Test {
63+
impl frame_system::Config for Test {
6464
type BaseCallFilter = ();
6565
type Origin = Origin;
6666
type Index = u64;
@@ -88,7 +88,7 @@ impl frame_system::Trait for Test {
8888
type SystemWeightInfo = ();
8989
}
9090

91-
impl pallet_balances::Trait for Test {
91+
impl pallet_balances::Config for Test {
9292
type MaxLocks = ();
9393
type Balance = u64;
9494
type Event = ();
@@ -98,7 +98,7 @@ impl pallet_balances::Trait for Test {
9898
type WeightInfo = ();
9999
}
100100

101-
impl Trait for Test {
101+
impl Config for Test {
102102
type Event = ();
103103
type Currency = pallet_balances::Module<Self>;
104104
type Randomness = TestRandomness;

0 commit comments

Comments
 (0)