timechain_runtime/configs/
governance.rsuse polkadot_sdk::*;
use frame_support::{parameter_types, traits::EitherOfDiverse, weights::Weight};
use frame_system::EnsureRoot;
use sp_runtime::Perbill;
use time_primitives::{AccountId, Balance, BlockNumber, ANLOG};
use crate::{
Runtime, RuntimeBlockWeights, RuntimeCall, RuntimeEvent, RuntimeOrigin, TechnicalCollective,
TechnicalCommittee, DAYS, HOURS,
};
parameter_types! {
pub const TechnicalMotionDuration: BlockNumber = 2 * DAYS;
pub const TechnicalMaxProposals: u32 = 100;
pub const TechnicalMaxMembers: u32 = 100;
pub MaxCollectivesProposalWeight: Weight = Perbill::from_percent(75) * RuntimeBlockWeights::get().max_block;
}
impl pallet_collective::Config<TechnicalCollective> for Runtime {
type RuntimeOrigin = RuntimeOrigin;
type Proposal = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type MotionDuration = TechnicalMotionDuration;
type MaxProposals = TechnicalMaxProposals;
type MaxMembers = TechnicalMaxMembers;
type DefaultVote = pallet_collective::PrimeDefaultVote;
type WeightInfo = pallet_collective::weights::SubstrateWeight<Runtime>;
type SetMembersOrigin = DefaultAdminOrigin;
type MaxProposalWeight = MaxCollectivesProposalWeight;
type DisapproveOrigin = DefaultAdminOrigin;
type KillOrigin = DefaultAdminOrigin;
type Consideration = ();
}
pub type TechnicalMember = pallet_collective::EnsureMember<AccountId, TechnicalCollective>;
pub type TechnicalHalf =
pallet_collective::EnsureProportionAtLeast<AccountId, TechnicalCollective, 1, 2>;
pub type TechnicalMajority =
pallet_collective::EnsureProportionMoreThan<AccountId, TechnicalCollective, 1, 2>;
pub type TechnicalQualifiedMajority =
pallet_collective::EnsureProportionAtLeast<AccountId, TechnicalCollective, 2, 3>;
pub type TechnicalSuperMajority =
pallet_collective::EnsureProportionAtLeast<AccountId, TechnicalCollective, 3, 4>;
pub type TechnicalUnanimity =
pallet_collective::EnsureProportionAtLeast<AccountId, TechnicalCollective, 1, 1>;
pub type EnsureRootOrTechnicalMember = EitherOfDiverse<EnsureRoot<AccountId>, TechnicalMember>;
pub type EnsureRootOrHalfTechnical = EitherOfDiverse<EnsureRoot<AccountId>, TechnicalHalf>;
#[cfg(not(any(feature = "testnet", feature = "develop")))]
pub type DefaultAdminOrigin = EnsureRootOrHalfTechnical;
#[cfg(any(feature = "testnet", feature = "develop"))]
pub type DefaultAdminOrigin = EnsureRootOrTechnicalMember;
impl pallet_membership::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type AddOrigin = DefaultAdminOrigin;
type RemoveOrigin = DefaultAdminOrigin;
type SwapOrigin = DefaultAdminOrigin;
type ResetOrigin = DefaultAdminOrigin;
type PrimeOrigin = DefaultAdminOrigin;
type MembershipInitialized = TechnicalCommittee;
type MembershipChanged = TechnicalCommittee;
type MaxMembers = TechnicalMaxMembers;
type WeightInfo = pallet_membership::weights::SubstrateWeight<Runtime>;
}
parameter_types! {
pub const EnterDuration: BlockNumber = 1 * DAYS;
pub const EnterDepositAmount: Balance = 5_000_000 * ANLOG; pub const ExtendDuration: BlockNumber = 12 * HOURS;
pub const ExtendDepositAmount: Balance = 2_000_000 * ANLOG;
pub const ReleaseDelay: u32 = 7 * DAYS;
}
impl pallet_governance::Config for Runtime {
type SystemAdmin = DefaultAdminOrigin;
type StakingAdmin = DefaultAdminOrigin;
#[cfg(feature = "develop")]
type BalancesAdmin = DefaultAdminOrigin;
}