use super::*; use frame_support::{ parameter_types, traits::{ EitherOf, EitherOfDiverse, MapSuccess, OriginTrait, TryWithMorphedArg, tokens::pay::PayFromAccount, }, }; use frame_system::EnsureRootWithSuccess; use sp_core::{ConstU128, ConstU32}; use sp_runtime::traits::{ConstU16, TakeFirst}; use pallet_ranked_collective::EnsureOfRank; use crate::{ // weights, RuntimeCall, RuntimeEvent, Scheduler, DAYS, CSPR, AccountId, Balance, TreasuryAccount, Balances, Preimage, Runtime, }; mod origins; pub use origins::{ pallet_cult_origins, Geniuses, Degens, Zombies, Skeletons, Ghosts, EnsureCanRetainAt, EnsureCanPromoteTo, EnsureCult, ToVoice, CultTreasurySpender, }; mod tracks; pub use tracks::TracksInfo; pub mod ranks { use pallet_ranked_collective::Rank; pub const LEVEL_1: Rank = 1; pub const LEVEL_2: Rank = 2; pub const LEVEL_3: Rank = 3; pub const LEVEL_4: Rank = 4; pub const LEVEL_5: Rank = 5; } impl pallet_cult_origins::Config for Runtime {} parameter_types! { pub const VoteLockingPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 1); } impl pallet_whitelist::Config for Runtime { type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; type WhitelistOrigin = EitherOfDiverse< EnsureRootWithSuccess>, Skeletons, >; type DispatchWhitelistedOrigin = EitherOf< EnsureRootWithSuccess>, Geniuses, >; type Preimages = Preimage; type WeightInfo = weights::pallet_whitelist::WeightInfo; } parameter_types! { pub const AlarmInterval: BlockNumber = 1; pub const UndecidingTimeout: BlockNumber = 7 * DAYS; pub const SubmissionDeposit: Balance = CSPR; } pub type CultReferendaInstance = pallet_referenda::Instance1; impl pallet_referenda::Config for Runtime { type WeightInfo = (); type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; type Scheduler = Scheduler; type Currency = Balances; type SubmitOrigin = EitherOf< pallet_ranked_collective::EnsureMember, MapSuccess< TryWithMorphedArg< RuntimeOrigin, ::PalletsOrigin, ToVoice, EnsureOfRank, (AccountId, u16), >, TakeFirst, > >; type CancelOrigin = Skeletons; type KillOrigin = Ghosts; type Slash = Treasury; type Votes = pallet_ranked_collective::Votes; type Tally = pallet_ranked_collective::TallyOf; type SubmissionDeposit = SubmissionDeposit; type MaxQueued = ConstU32<100>; type UndecidingTimeout = UndecidingTimeout; type AlarmInterval = AlarmInterval; type Tracks = TracksInfo; type Preimages = Preimage; } pub type CultCollectiveInstance = pallet_ranked_collective::Instance1; impl pallet_ranked_collective::Config for Runtime { type WeightInfo = weights::pallet_ranked_collective::WeightInfo; type RuntimeEvent = RuntimeEvent; #[cfg(not(feature = "runtime-benchmarks"))] type PromoteOrigin = frame_system::EnsureNever; #[cfg(feature = "runtime-benchmarks")] type PromoteOrigin = EnsureRootWithSuccess>; #[cfg(not(feature = "runtime-benchmarks"))] type AddOrigin = frame_system::EnsureNever; #[cfg(feature = "runtime-benchmarks")] type AddOrigin = EnsureRootWithSuccess>; #[cfg(not(feature = "runtime-benchmarks"))] type RemoveOrigin = frame_system::EnsureNever; #[cfg(feature = "runtime-benchmarks")] type RemoveOrigin = EnsureRootWithSuccess>; type DemoteOrigin = EitherOf>, Ghosts>; type ExchangeOrigin = EitherOf>, Ghosts>; type Polls = CultReferenda; type MinRankOfClass = tracks::MinRankOfClass; type MemberSwappedHandler = (crate::CultCore, crate::CultSalary); type VoteWeight = pallet_ranked_collective::Geometric; #[cfg(feature = "runtime-benchmarks")] type BenchmarkSetup = (crate::CultCore, crate::CultSalary); } pub type CultCoreInstance = pallet_core_fellowship::Instance1; impl pallet_core_fellowship::Config for Runtime { type WeightInfo = weights::pallet_core_fellowship::WeightInfo; type RuntimeEvent = RuntimeEvent; type Members = pallet_ranked_collective::Pallet; type Balance = Balance; type ParamsOrigin = EitherOf>, Skeletons>; type InductOrigin = EitherOf>, Zombies>; type ApproveOrigin = EitherOf>, EnsureCanRetainAt>; type PromoteOrigin = EitherOf>, EnsureCanPromoteTo>; type EvidenceSize = ConstU32<65536>; } pub type CultSalaryInstance = pallet_salary::Instance1; impl pallet_salary::Config for Runtime { type WeightInfo = weights::pallet_salary::WeightInfo; type RuntimeEvent = RuntimeEvent; type Paymaster = PayFromAccount; type Members = pallet_ranked_collective::Pallet; #[cfg(not(feature = "runtime-benchmarks"))] type Salary = pallet_core_fellowship::Pallet; #[cfg(feature = "runtime-benchmarks")] type Salary = frame_support::traits::tokens::ConvertRank< crate::impls::benchmarks::RankToSalary, >; type RegistrationPeriod = ConstU32<{ 15 * DAYS }>; type PayoutPeriod = ConstU32<{ 15 * DAYS }>; type Budget = ConstU128<{ 100 * CSPR }>; }