mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 02:21:04 +00:00
Replace 'Module' with 'Pallet' in construct_runtime macro (#8372)
* Use 'Pallet' struct in construct_runtime. * Fix genesis and metadata macro. * Fix 'Pallet' type alias. * Replace 'Module' with 'Pallet' for all construct_runtime use cases. * Replace more deprecated 'Module' struct. * Bring back AllModules and AllPalletsWithSystem type, but deprecate them. * Replace deprecated 'Module' struct from merge master. * Minor fix. * Fix UI tests. * Revert UI override in derive_no_bound. * Fix more deprecated 'Module' use from master branch. * Fix more deprecated 'Module' use from master branch.
This commit is contained in:
@@ -84,7 +84,7 @@ fn setup_pot_account<T: Config>() {
|
||||
}
|
||||
|
||||
fn assert_last_event<T: Config>(generic_event: <T as Config>::Event) {
|
||||
let events = frame_system::Module::<T>::events();
|
||||
let events = frame_system::Pallet::<T>::events();
|
||||
let system_event: <T as frame_system::Config>::Event = generic_event.into();
|
||||
// compare to the last event record
|
||||
let EventRecord { event, .. } = &events[events.len() - 1];
|
||||
@@ -122,7 +122,7 @@ benchmarks! {
|
||||
let (curator_lookup, bounty_id) = create_bounty::<T>()?;
|
||||
Bounties::<T>::on_initialize(T::BlockNumber::zero());
|
||||
let bounty_id = BountyCount::get() - 1;
|
||||
frame_system::Module::<T>::set_block_number(T::BountyUpdatePeriod::get() + 1u32.into());
|
||||
frame_system::Pallet::<T>::set_block_number(T::BountyUpdatePeriod::get() + 1u32.into());
|
||||
let caller = whitelisted_caller();
|
||||
}: _(RawOrigin::Signed(caller), bounty_id)
|
||||
|
||||
@@ -159,7 +159,7 @@ benchmarks! {
|
||||
let beneficiary = T::Lookup::unlookup(beneficiary_account.clone());
|
||||
Bounties::<T>::award_bounty(RawOrigin::Signed(curator.clone()).into(), bounty_id, beneficiary)?;
|
||||
|
||||
frame_system::Module::<T>::set_block_number(T::BountyDepositPayoutDelay::get());
|
||||
frame_system::Pallet::<T>::set_block_number(T::BountyDepositPayoutDelay::get());
|
||||
ensure!(T::Currency::free_balance(&beneficiary_account).is_zero(), "Beneficiary already has balance");
|
||||
|
||||
}: _(RawOrigin::Signed(curator), bounty_id)
|
||||
|
||||
@@ -424,7 +424,7 @@ decl_module! {
|
||||
// If the sender is not the curator, and the curator is inactive,
|
||||
// slash the curator.
|
||||
if sender != *curator {
|
||||
let block_number = system::Module::<T>::block_number();
|
||||
let block_number = system::Pallet::<T>::block_number();
|
||||
if *update_due < block_number {
|
||||
slash_curator(curator, &mut bounty.curator_deposit);
|
||||
// Continue to change bounty status below...
|
||||
@@ -479,7 +479,7 @@ decl_module! {
|
||||
T::Currency::reserve(curator, deposit)?;
|
||||
bounty.curator_deposit = deposit;
|
||||
|
||||
let update_due = system::Module::<T>::block_number() + T::BountyUpdatePeriod::get();
|
||||
let update_due = system::Pallet::<T>::block_number() + T::BountyUpdatePeriod::get();
|
||||
bounty.status = BountyStatus::Active { curator: curator.clone(), update_due };
|
||||
|
||||
Ok(())
|
||||
@@ -518,7 +518,7 @@ decl_module! {
|
||||
bounty.status = BountyStatus::PendingPayout {
|
||||
curator: signer,
|
||||
beneficiary: beneficiary.clone(),
|
||||
unlock_at: system::Module::<T>::block_number() + T::BountyDepositPayoutDelay::get(),
|
||||
unlock_at: system::Pallet::<T>::block_number() + T::BountyDepositPayoutDelay::get(),
|
||||
};
|
||||
|
||||
Ok(())
|
||||
@@ -543,7 +543,7 @@ decl_module! {
|
||||
Bounties::<T>::try_mutate_exists(bounty_id, |maybe_bounty| -> DispatchResult {
|
||||
let bounty = maybe_bounty.take().ok_or(Error::<T>::InvalidIndex)?;
|
||||
if let BountyStatus::PendingPayout { curator, beneficiary, unlock_at } = bounty.status {
|
||||
ensure!(system::Module::<T>::block_number() >= unlock_at, Error::<T>::Premature);
|
||||
ensure!(system::Pallet::<T>::block_number() >= unlock_at, Error::<T>::Premature);
|
||||
let bounty_account = Self::bounty_account_id(bounty_id);
|
||||
let balance = T::Currency::free_balance(&bounty_account);
|
||||
let fee = bounty.fee.min(balance); // just to be safe
|
||||
@@ -649,7 +649,7 @@ decl_module! {
|
||||
match bounty.status {
|
||||
BountyStatus::Active { ref curator, ref mut update_due } => {
|
||||
ensure!(*curator == signer, Error::<T>::RequireCurator);
|
||||
*update_due = (system::Module::<T>::block_number() + T::BountyUpdatePeriod::get()).max(*update_due);
|
||||
*update_due = (system::Pallet::<T>::block_number() + T::BountyUpdatePeriod::get()).max(*update_due);
|
||||
},
|
||||
_ => return Err(Error::<T>::UnexpectedStatus.into()),
|
||||
}
|
||||
|
||||
@@ -43,10 +43,10 @@ frame_support::construct_runtime!(
|
||||
NodeBlock = Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
||||
{
|
||||
System: frame_system::{Module, Call, Config, Storage, Event<T>},
|
||||
Balances: pallet_balances::{Module, Call, Storage, Config<T>, Event<T>},
|
||||
Bounties: pallet_bounties::{Module, Call, Storage, Event<T>},
|
||||
Treasury: pallet_treasury::{Module, Call, Storage, Config, Event<T>},
|
||||
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
|
||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||
Bounties: pallet_bounties::{Pallet, Call, Storage, Event<T>},
|
||||
Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>},
|
||||
}
|
||||
);
|
||||
|
||||
@@ -107,7 +107,7 @@ parameter_types! {
|
||||
// impl pallet_treasury::Config for Test {
|
||||
impl pallet_treasury::Config for Test {
|
||||
type ModuleId = TreasuryModuleId;
|
||||
type Currency = pallet_balances::Module<Test>;
|
||||
type Currency = pallet_balances::Pallet<Test>;
|
||||
type ApproveOrigin = frame_system::EnsureRoot<u128>;
|
||||
type RejectOrigin = frame_system::EnsureRoot<u128>;
|
||||
type Event = Event;
|
||||
|
||||
Reference in New Issue
Block a user