Fellowship: Voters can initiate proposals on their votable tracks (#2725)

* Voters can initiate proposals on their tracks in Fellowship

* Bump

* Remove it_builds

* Docs
This commit is contained in:
Gavin Wood
2023-06-19 11:41:50 +02:00
committed by GitHub
parent 6beb11e8cc
commit cf68e59132
2 changed files with 65 additions and 13 deletions
@@ -19,28 +19,28 @@
pub(crate) mod migration;
mod origins;
mod tracks;
use cumulus_primitives_core::Junction::GeneralIndex;
use frame_system::EnsureNever;
pub use origins::{
pallet_origins as pallet_fellowship_origins, Architects, EnsureCanPromoteTo, EnsureCanRetainAt,
EnsureFellowship, Fellows, Masters, Members,
};
use xcm_builder::{AliasesIntoAccountId32, LocatableAssetId, PayOverXcm};
use crate::{
constants, impls::ToParentTreasury, weights, AccountId, Balance, Balances, FellowshipReferenda,
GovernanceLocation, PolkadotTreasuryAccount, Preimage, Runtime, RuntimeCall, RuntimeEvent,
Scheduler, DAYS,
RuntimeOrigin, Scheduler, DAYS,
};
use cumulus_primitives_core::Junction::GeneralIndex;
use frame_support::{
parameter_types,
traits::{EitherOf, EitherOfDiverse, MapSuccess},
traits::{EitherOf, EitherOfDiverse, MapSuccess, OriginTrait, TryWithMorphedArg},
};
use frame_system::EnsureNever;
pub use origins::{
pallet_origins as pallet_fellowship_origins, Architects, EnsureCanPromoteTo, EnsureCanRetainAt,
EnsureFellowship, Fellows, Masters, Members, ToVoice,
};
use pallet_ranked_collective::EnsureOfRank;
use pallet_xcm::{EnsureXcm, IsVoiceOfBody};
use polkadot_runtime_constants::{time::HOURS, xcm::body::FELLOWSHIP_ADMIN_INDEX};
use sp_core::{ConstU128, ConstU32};
use sp_runtime::traits::{AccountIdConversion, ConstU16, ConvertToValue, Replace};
use sp_runtime::traits::{AccountIdConversion, ConstU16, ConvertToValue, Replace, TakeFirst};
use xcm::latest::BodyId;
use xcm_builder::{AliasesIntoAccountId32, LocatableAssetId, PayOverXcm};
/// The Fellowship members' ranks.
pub mod ranks {
@@ -74,8 +74,19 @@ impl pallet_referenda::Config<FellowshipReferendaInstance> for Runtime {
type Scheduler = Scheduler;
type Currency = Balances;
// Fellows can submit proposals.
type SubmitOrigin =
pallet_ranked_collective::EnsureMember<Runtime, FellowshipCollectiveInstance, 3>;
type SubmitOrigin = EitherOf<
pallet_ranked_collective::EnsureMember<Runtime, FellowshipCollectiveInstance, 3>,
MapSuccess<
TryWithMorphedArg<
RuntimeOrigin,
<RuntimeOrigin as OriginTrait>::PalletsOrigin,
ToVoice,
EnsureOfRank<Runtime, FellowshipCollectiveInstance>,
(AccountId, u16),
>,
TakeFirst,
>,
>;
type CancelOrigin = Architects;
type KillOrigin = Masters;
type Slash = ToParentTreasury<PolkadotTreasuryAccount, ReferendaPalletAccount, Runtime>;