mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 02: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
@@ -17,7 +17,7 @@
|
||||
|
||||
//! # Society Module
|
||||
//!
|
||||
//! - [`society::Trait`](./trait.Trait.html)
|
||||
//! - [`society::Config`](./trait.Config.html)
|
||||
//! - [`Call`](./enum.Call.html)
|
||||
//!
|
||||
//! ## Overview
|
||||
@@ -268,13 +268,13 @@ use frame_support::traits::{
|
||||
};
|
||||
use frame_system::{self as system, ensure_signed, ensure_root};
|
||||
|
||||
type BalanceOf<T, I> = <<T as Trait<I>>::Currency as Currency<<T as system::Trait>::AccountId>>::Balance;
|
||||
type NegativeImbalanceOf<T> = <<T as Trait>::Currency as Currency<<T as frame_system::Trait>::AccountId>>::NegativeImbalance;
|
||||
type BalanceOf<T, I> = <<T as Config<I>>::Currency as Currency<<T as system::Config>::AccountId>>::Balance;
|
||||
type NegativeImbalanceOf<T> = <<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::NegativeImbalance;
|
||||
|
||||
/// The module's configuration trait.
|
||||
pub trait Trait<I=DefaultInstance>: system::Trait {
|
||||
pub trait Config<I=DefaultInstance>: system::Config {
|
||||
/// The overarching event type.
|
||||
type Event: From<Event<Self, I>> + Into<<Self as system::Trait>::Event>;
|
||||
type Event: From<Event<Self, I>> + Into<<Self as system::Config>::Event>;
|
||||
|
||||
/// The societies's module id
|
||||
type ModuleId: Get<ModuleId>;
|
||||
@@ -403,7 +403,7 @@ impl<AccountId: PartialEq, Balance> BidKind<AccountId, Balance> {
|
||||
|
||||
// This module's storage items.
|
||||
decl_storage! {
|
||||
trait Store for Module<T: Trait<I>, I: Instance=DefaultInstance> as Society {
|
||||
trait Store for Module<T: Config<I>, I: Instance=DefaultInstance> as Society {
|
||||
/// The first member.
|
||||
pub Founder get(fn founder) build(|config: &GenesisConfig<T, I>| config.members.first().cloned()):
|
||||
Option<T::AccountId>;
|
||||
@@ -472,7 +472,7 @@ decl_storage! {
|
||||
// The module's dispatchable functions.
|
||||
decl_module! {
|
||||
/// The module declaration.
|
||||
pub struct Module<T: Trait<I>, I: Instance=DefaultInstance> for enum Call where origin: T::Origin {
|
||||
pub struct Module<T: Config<I>, I: Instance=DefaultInstance> for enum Call where origin: T::Origin {
|
||||
type Error = Error<T, I>;
|
||||
/// The minimum amount of a deposit required for a bid to be made.
|
||||
const CandidateDeposit: BalanceOf<T, I> = T::CandidateDeposit::get();
|
||||
@@ -1065,7 +1065,7 @@ decl_module! {
|
||||
|
||||
decl_error! {
|
||||
/// Errors for this module.
|
||||
pub enum Error for Module<T: Trait<I>, I: Instance> {
|
||||
pub enum Error for Module<T: Config<I>, I: Instance> {
|
||||
/// An incorrect position was provided.
|
||||
BadPosition,
|
||||
/// User is not a member.
|
||||
@@ -1108,7 +1108,7 @@ decl_error! {
|
||||
decl_event! {
|
||||
/// Events for this module.
|
||||
pub enum Event<T, I=DefaultInstance> where
|
||||
AccountId = <T as system::Trait>::AccountId,
|
||||
AccountId = <T as system::Config>::AccountId,
|
||||
Balance = BalanceOf<T, I>
|
||||
{
|
||||
/// The society is founded by the given identity. \[founder\]
|
||||
@@ -1151,7 +1151,7 @@ decl_event! {
|
||||
|
||||
/// Simple ensure origin struct to filter for the founder account.
|
||||
pub struct EnsureFounder<T>(sp_std::marker::PhantomData<T>);
|
||||
impl<T: Trait> EnsureOrigin<T::Origin> for EnsureFounder<T> {
|
||||
impl<T: Config> EnsureOrigin<T::Origin> for EnsureFounder<T> {
|
||||
type Success = T::AccountId;
|
||||
fn try_origin(o: T::Origin) -> Result<Self::Success, T::Origin> {
|
||||
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 {
|
||||
(rng.next_u32() % (max as u32 + 1)) as usize
|
||||
}
|
||||
|
||||
impl<T: Trait<I>, I: Instance> Module<T, I> {
|
||||
impl<T: Config<I>, I: Instance> Module<T, I> {
|
||||
/// Puts a bid into storage ordered by smallest to largest value.
|
||||
/// Allows a maximum of 1000 bids in queue, removing largest value people first.
|
||||
fn put_bid(
|
||||
@@ -1669,7 +1669,7 @@ impl<T: Trait<I>, I: Instance> Module<T, I> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Trait> OnUnbalanced<NegativeImbalanceOf<T>> for Module<T> {
|
||||
impl<T: Config> OnUnbalanced<NegativeImbalanceOf<T>> for Module<T> {
|
||||
fn on_nonzero_unbalanced(amount: NegativeImbalanceOf<T>) {
|
||||
let numeric_amount = amount.peek();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user