Frame: Give Referendum SubmitOrigin argument (#14326)

* Referedum's SubmitOrigin should have an arg

* Fixes

* Nits and two extra utils

* Fixes

* Fixes
This commit is contained in:
Gavin Wood
2023-06-12 09:10:19 +01:00
committed by GitHub
parent 62f37e105c
commit 9716c8a1cb
14 changed files with 462 additions and 88 deletions
+9 -2
View File
@@ -252,10 +252,11 @@ mod mock;
mod tests;
use frame_support::{
impl_ensure_origin_with_arg_ignoring_arg,
pallet_prelude::*,
traits::{
BalanceStatus, ChangeMembers, Currency, EnsureOrigin, ExistenceRequirement::AllowDeath,
Imbalance, OnUnbalanced, Randomness, ReservableCurrency,
BalanceStatus, ChangeMembers, Currency, EnsureOrigin, EnsureOriginWithArg,
ExistenceRequirement::AllowDeath, Imbalance, OnUnbalanced, Randomness, ReservableCurrency,
},
PalletId,
};
@@ -1181,6 +1182,12 @@ impl<T: Config> EnsureOrigin<T::RuntimeOrigin> for EnsureFounder<T> {
}
}
impl_ensure_origin_with_arg_ignoring_arg! {
impl<{ T: Config, A }>
EnsureOriginWithArg<T::RuntimeOrigin, A> for EnsureFounder<T>
{}
}
/// Pick an item at pseudo-random from the slice, given the `rng`. `None` iff the slice is empty.
fn pick_item<'a, R: RngCore, T>(rng: &mut R, items: &'a [T]) -> Option<&'a T> {
if items.is_empty() {