mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-15 13:51:11 +00:00
Purify Contains, add IsInVec, All and SortedMembers (#8589)
* IsInVec * Purify `Contains`, introduce SortedMembers
This commit is contained in:
@@ -68,7 +68,7 @@ use frame_support::traits::{
|
||||
use sp_runtime::{ Percent, RuntimeDebug, traits::{
|
||||
Zero, AccountIdConversion, Hash, BadOrigin
|
||||
}};
|
||||
use frame_support::traits::{Contains, ContainsLengthBound, OnUnbalanced, EnsureOrigin};
|
||||
use frame_support::traits::{SortedMembers, ContainsLengthBound, OnUnbalanced, EnsureOrigin};
|
||||
use codec::{Encode, Decode};
|
||||
use frame_system::{self as system, ensure_signed};
|
||||
pub use weights::WeightInfo;
|
||||
@@ -86,7 +86,7 @@ pub trait Config: frame_system::Config + pallet_treasury::Config {
|
||||
/// Origin from which tippers must come.
|
||||
///
|
||||
/// `ContainsLengthBound::max_len` must be cost free (i.e. no storage read or heavy operation).
|
||||
type Tippers: Contains<Self::AccountId> + ContainsLengthBound;
|
||||
type Tippers: SortedMembers<Self::AccountId> + ContainsLengthBound;
|
||||
|
||||
/// The period for which a tip remains open after is has achieved threshold tippers.
|
||||
type TipCountdown: Get<Self::BlockNumber>;
|
||||
|
||||
@@ -24,7 +24,7 @@ use super::*;
|
||||
use std::cell::RefCell;
|
||||
use frame_support::{
|
||||
assert_noop, assert_ok, parameter_types,
|
||||
weights::Weight, traits::Contains,
|
||||
weights::Weight, traits::SortedMembers,
|
||||
PalletId
|
||||
};
|
||||
use sp_runtime::Permill;
|
||||
@@ -98,7 +98,7 @@ thread_local! {
|
||||
static TEN_TO_FOURTEEN: RefCell<Vec<u128>> = RefCell::new(vec![10,11,12,13,14]);
|
||||
}
|
||||
pub struct TenToFourteen;
|
||||
impl Contains<u128> for TenToFourteen {
|
||||
impl SortedMembers<u128> for TenToFourteen {
|
||||
fn sorted_members() -> Vec<u128> {
|
||||
TEN_TO_FOURTEEN.with(|v| {
|
||||
v.borrow().clone()
|
||||
|
||||
Reference in New Issue
Block a user