mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 02:21:04 +00:00
Make Pallet ModuleId and LockIdentifier Configurable (#5695)
* transition treasury to configurable moduleids * make election module id configurable * convert runtime and pallet to accept module id config elections-phragmen * add ModuleId to evm pallet * change society pallet to configurable module id * delete commented out module_id * delete commented out code and merge in upstream master * try and convert 4 whitespace to tab * fix remaining space to tab conversions * trivial cleaning * delete comment from elections-phragrems tests * trivial * Update frame/elections-phragmen/src/lib.rs * add docs for elections and elections phragmen * make has_lock test get moduleid dynamically * Apply suggestions from code review Co-Authored-By: Amar Singh <asinghchrony@protonmail.com> * make sure get is imported to evm Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com> Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: Amar Singh <asinghchrony@protonmail.com> Co-authored-by: Benjamin Kampmann <ben@gnunicorn.org>
This commit is contained in:
@@ -269,13 +269,14 @@ 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;
|
||||
|
||||
const MODULE_ID: ModuleId = ModuleId(*b"py/socie");
|
||||
|
||||
/// The module's configuration trait.
|
||||
pub trait Trait<I=DefaultInstance>: system::Trait {
|
||||
/// The overarching event type.
|
||||
type Event: From<Event<Self, I>> + Into<<Self as system::Trait>::Event>;
|
||||
|
||||
/// The societies's module id
|
||||
type ModuleId: Get<ModuleId>;
|
||||
|
||||
/// The currency type used for bidding.
|
||||
type Currency: ReservableCurrency<Self::AccountId>;
|
||||
|
||||
@@ -491,6 +492,9 @@ decl_module! {
|
||||
/// The number of blocks between membership challenges.
|
||||
const ChallengePeriod: T::BlockNumber = T::ChallengePeriod::get();
|
||||
|
||||
/// The societies's module id
|
||||
const ModuleId: ModuleId = T::ModuleId::get();
|
||||
|
||||
// Used for handling module events.
|
||||
fn deposit_event() = default;
|
||||
|
||||
@@ -1570,7 +1574,7 @@ impl<T: Trait<I>, I: Instance> Module<T, I> {
|
||||
/// This actually does computation. If you need to keep using it, then make sure you cache the
|
||||
/// value and only call this once.
|
||||
pub fn account_id() -> T::AccountId {
|
||||
MODULE_ID.into_account()
|
||||
T::ModuleId::get().into_account()
|
||||
}
|
||||
|
||||
/// The account ID of the payouts pot. This is where payouts are made from.
|
||||
@@ -1578,7 +1582,7 @@ impl<T: Trait<I>, I: Instance> Module<T, I> {
|
||||
/// This actually does computation. If you need to keep using it, then make sure you cache the
|
||||
/// value and only call this once.
|
||||
pub fn payouts() -> T::AccountId {
|
||||
MODULE_ID.into_sub_account(b"payouts")
|
||||
T::ModuleId::get().into_sub_account(b"payouts")
|
||||
}
|
||||
|
||||
/// Return the duration of the lock, in blocks, with the given number of members.
|
||||
|
||||
Reference in New Issue
Block a user