Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

feat(runtime-collectives): added type for ranked collective #2881

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ use crate::{
use cumulus_primitives_core::Junction::GeneralIndex;
use frame_support::{
parameter_types,
traits::{EitherOf, EitherOfDiverse, MapSuccess, OriginTrait, TryWithMorphedArg},
traits::{EitherOf, EitherOfDiverse, Ignore, MapSuccess, OriginTrait, TryWithMorphedArg},
};
use frame_system::EnsureRootWithSuccess;
use frame_system::{EnsureNever, EnsureRoot, EnsureRootWithSuccess};
pub use origins::{
pallet_origins as pallet_fellowship_origins, Architects, EnsureCanPromoteTo, EnsureCanRetainAt,
EnsureFellowship, Fellows, Masters, Members, ToVoice,
Expand Down Expand Up @@ -111,7 +111,11 @@ impl pallet_ranked_collective::Config<FellowshipCollectiveInstance> for Runtime

#[cfg(not(feature = "runtime-benchmarks"))]
// Promotions and the induction of new members are serviced by `FellowshipCore` pallet instance.
type PromoteOrigin = frame_system::EnsureNever<pallet_ranked_collective::Rank>;
type AddOrigin = EnsureNever<()>;
#[cfg(not(feature = "runtime-benchmarks"))]
type PromoteOrigin = EnsureNever<pallet_ranked_collective::Rank>;
#[cfg(feature = "runtime-benchmarks")]
type AddOrigin = EnsureRoot<Self::AccountId>;
#[cfg(feature = "runtime-benchmarks")]
// The maximum value of `u16` set as a success value for the root to ensure the benchmarks will pass.
type PromoteOrigin = EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>;
Expand All @@ -121,6 +125,7 @@ impl pallet_ranked_collective::Config<FellowshipCollectiveInstance> for Runtime
// - the FellowshipAdmin origin (i.e. token holder referendum);
//
// The maximum value of `u16` set as a success value for the root to ensure the benchmarks will pass.
type RemoveOrigin = MapSuccess<Self::DemoteOrigin, Ignore>;
type DemoteOrigin = EitherOf<
EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>,
MapSuccess<
Expand Down