difftreelog
Pallet Democracy
in: master
3 files changed
node/src/chain_spec.rsdiffbeforeafterboth--- a/node/src/chain_spec.rs
+++ b/node/src/chain_spec.rs
@@ -147,12 +147,24 @@
pallet_aura: Some(AuraConfig {
authorities: initial_authorities.iter().map(|x| (x.0.clone())).collect(),
}),
- pallet_grandpa: Some(GrandpaConfig {
+ pallet_collective_Instance1: Some(CouncilConfig {
+ members: vec![],
+ phantom: Default::default(),
+ }),
+ pallet_collective_Instance2: Some(TechnicalCommitteeConfig {
+ members: vec![],
+ phantom: Default::default(),
+ }),
+ pallet_democracy: Some(DemocracyConfig::default()),
+ pallet_grandpa: Some(GrandpaConfig {
authorities: initial_authorities
.iter()
.map(|x| (x.1.clone(), 1))
.collect(),
- }),
+ }),
+ pallet_elections_phragmen: Some(Default::default()),
+ pallet_membership: Some(Default::default()),
+ pallet_treasury: Some(Default::default()),
pallet_sudo: Some(SudoConfig { key: root_key }),
pallet_nft: Some(NftConfig {
collection: vec![(
runtime/Cargo.tomldiffbeforeafterboth1[package]2authors = ['Substrate DevHub <https://github.com/substrate-developer-hub>']3edition = '2018'4homepage = 'https://substrate.io'5license = 'Unlicense'6name = 'nft-runtime'7repository = 'https://github.com/usetech-llc/nft_parachain/'8version = '2.0.0'910[package.metadata.docs.rs]11targets = ['x86_64-unknown-linux-gnu']1213[build-dependencies]14wasm-builder-runner = { package = 'substrate-wasm-builder-runner', version = '1.0.5' }1516# alias "parity-scale-code" to "codec"17[dependencies.codec]18default-features = false19features = ['derive']20package = 'parity-scale-codec'21version = '1.3.4'2223[dependencies]24hex-literal = { optional = true, version = '0.3.1' }25serde = { features = ['derive'], optional = true, version = '1.0.101' }2627# local dependencies28pallet-nft = { path = '../pallets/nft', default-features = false, version = '2.0.0' }2930# Substrate dependencies31frame-benchmarking = { default-features = false, optional = true, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }32frame-executive = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }33frame-support = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }34frame-system = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }35frame-system-benchmarking = { default-features = false, optional = true, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }36frame-system-rpc-runtime-api = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }37pallet-aura = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }38pallet-balances = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }39pallet-contracts = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }40pallet-contracts-primitives = { default-features = false, version = '2.0.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }41pallet-contracts-rpc-runtime-api = { default-features = false, version = '0.8.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }42pallet-grandpa = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }43pallet-randomness-collective-flip = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }44pallet-sudo = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }45pallet-timestamp = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }46pallet-transaction-payment = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }47pallet-transaction-payment-rpc-runtime-api = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }48sp-api = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }49sp-block-builder = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }50sp-consensus-aura = { default-features = false, version = '0.8.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }51sp-core = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }52sp-inherents = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }53sp-offchain = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }54sp-runtime = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }55sp-session = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }56sp-std = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }57sp-transaction-pool = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }58sp-version = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }5960[features]61default = ['std']62runtime-benchmarks = [63 'hex-literal',64 'frame-benchmarking',65 'frame-support/runtime-benchmarks',66 'frame-system-benchmarking',67 'frame-system/runtime-benchmarks',68 'pallet-balances/runtime-benchmarks',69 'pallet-timestamp/runtime-benchmarks',70 'pallet-nft/runtime-benchmarks',71 'sp-runtime/runtime-benchmarks',72]73std = [74 'codec/std',75 'serde',76 'frame-executive/std',77 'frame-support/std',78 'frame-system/std',79 'frame-system-rpc-runtime-api/std',80 'pallet-aura/std',81 'pallet-balances/std',82 'pallet-contracts/std',83 'pallet-contracts-primitives/std',84 'pallet-contracts-rpc-runtime-api/std',85 'pallet-grandpa/std',86 'pallet-randomness-collective-flip/std',87 'pallet-sudo/std',88 'pallet-timestamp/std',89 'pallet-transaction-payment/std',90 'pallet-transaction-payment-rpc-runtime-api/std',91 'pallet-nft/std',92 'sp-api/std',93 'sp-block-builder/std',94 'sp-consensus-aura/std',95 'sp-core/std',96 'sp-inherents/std',97 'sp-offchain/std',98 'sp-runtime/std',99 'sp-session/std',100 'sp-std/std',101 'sp-transaction-pool/std',102 'sp-version/std',103]1[package]2authors = ['Substrate DevHub <https://github.com/substrate-developer-hub>']3edition = '2018'4homepage = 'https://substrate.io'5license = 'Unlicense'6name = 'nft-runtime'7repository = 'https://github.com/usetech-llc/nft_parachain/'8version = '2.0.0'910[package.metadata.docs.rs]11targets = ['x86_64-unknown-linux-gnu']1213[build-dependencies]14wasm-builder-runner = { package = 'substrate-wasm-builder-runner', version = '1.0.5' }1516# alias "parity-scale-code" to "codec"17[dependencies.codec]18default-features = false19features = ['derive']20package = 'parity-scale-codec'21version = '1.3.4'2223[dependencies]24hex-literal = { optional = true, version = '0.3.1' }25serde = { features = ['derive'], optional = true, version = '1.0.101' }2627# local dependencies28pallet-nft = { path = '../pallets/nft', default-features = false, version = '2.0.0' }2930# Substrate dependencies31frame-benchmarking = { default-features = false, optional = true, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }32frame-executive = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }33frame-support = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }34frame-system = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }35frame-system-benchmarking = { default-features = false, optional = true, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }36frame-system-rpc-runtime-api = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }37pallet-aura = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }38pallet-balances = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }39pallet-contracts = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }40pallet-contracts-primitives = { default-features = false, version = '2.0.0', git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }41pallet-contracts-rpc-runtime-api = { default-features = false, version = '0.8.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }42pallet-grandpa = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }43pallet-randomness-collective-flip = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }44pallet-sudo = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }45pallet-timestamp = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }46pallet-transaction-payment = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }47pallet-transaction-payment-rpc-runtime-api = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }48sp-api = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }49sp-block-builder = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }50sp-consensus-aura = { default-features = false, version = '0.8.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }51sp-core = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }52sp-inherents = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }53sp-offchain = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }54sp-runtime = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }55sp-session = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }56sp-std = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }57sp-transaction-pool = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }58sp-version = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }5960pallet-membership = { version = "2.0.0", default-features = false, git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }61pallet-collective = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }62pallet-democracy = { default-features = false, version = '2.0.0' , git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }63pallet-elections-phragmen = { version = "2.0.0", default-features = false, git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }64pallet-treasury = { version = "2.0.0", default-features = false, git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }65pallet-scheduler = { version = "2.0.0", default-features = false, git = 'https://github.com/usetech-llc/substrate.git', branch = 'v2.0.0_release' }6667[features]68default = ['std']69runtime-benchmarks = [70 'hex-literal',71 'frame-benchmarking',72 'frame-support/runtime-benchmarks',73 'frame-system-benchmarking',74 'frame-system/runtime-benchmarks',75 'pallet-balances/runtime-benchmarks',76 'pallet-timestamp/runtime-benchmarks',77 'pallet-nft/runtime-benchmarks',78 'sp-runtime/runtime-benchmarks',79]80std = [81 'codec/std',82 'serde',83 'frame-executive/std',84 'frame-support/std',85 'frame-system/std',86 'frame-system-rpc-runtime-api/std',87 'pallet-aura/std',88 'pallet-balances/std',89 'pallet-contracts/std',90 'pallet-contracts-primitives/std',91 'pallet-contracts-rpc-runtime-api/std',92 'pallet-grandpa/std',93 'pallet-randomness-collective-flip/std',94 'pallet-sudo/std',95 'pallet-timestamp/std',96 'pallet-transaction-payment/std',97 'pallet-transaction-payment-rpc-runtime-api/std',98 'pallet-nft/std',99 'sp-api/std',100 'sp-block-builder/std',101 'sp-consensus-aura/std',102 'sp-core/std',103 'sp-inherents/std',104 'sp-offchain/std',105 'sp-runtime/std',106 'sp-session/std',107 'sp-std/std',108 'sp-transaction-pool/std',109 'sp-version/std',110111 'pallet-collective/std',112 'pallet-democracy/std',113 'pallet-elections-phragmen/std', 114 'pallet-membership/std',115 'pallet-treasury/std',116 'pallet-scheduler/std',117]runtime/src/lib.rsdiffbeforeafterboth--- a/runtime/src/lib.rs
+++ b/runtime/src/lib.rs
@@ -13,12 +13,16 @@
use pallet_grandpa::{AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList};
use sp_api::impl_runtime_apis;
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
-use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
+use sp_core::{
+ crypto::KeyTypeId,
+ OpaqueMetadata,
+ u32_trait::{_1, _2, _3, _4},
+};
use sp_runtime::{
create_runtime_str, generic, impl_opaque_keys,
traits::{
- BlakeTwo256, Block as BlockT, IdentifyAccount, IdentityLookup, NumberFor, Saturating,
- Verify,
+ Convert, BlakeTwo256, Block as BlockT, IdentifyAccount,
+ IdentityLookup, NumberFor, Saturating, Verify,
},
transaction_validity::{TransactionSource, TransactionValidity},
ApplyExtrinsicResult, MultiSignature,
@@ -37,7 +41,7 @@
parameter_types,
traits::{
Currency, ExistenceRequirement, Get, KeyOwnerProofSystem, OnUnbalanced, Randomness,
- WithdrawReason,
+ WithdrawReason, LockIdentifier,
},
weights::{
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
@@ -48,11 +52,33 @@
};
#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;
-use sp_runtime::Perbill;
-use frame_system::{self as system};
+use sp_runtime:: { Perbill, Permill, Percent, ModuleId };
+use frame_system::{self as system, EnsureRoot, EnsureOneOf };
pub use pallet_timestamp::Call as TimestampCall;
+/// Struct that handles the conversion of Balance -> `u64`. This is used for
+/// staking's election calculation.
+pub struct CurrencyToVoteHandler;
+
+impl CurrencyToVoteHandler {
+ fn factor() -> Balance {
+ (Balances::total_issuance() / u64::max_value() as Balance).max(1)
+ }
+}
+
+impl Convert<Balance, u64> for CurrencyToVoteHandler {
+ fn convert(x: Balance) -> u64 {
+ (x / Self::factor()) as u64
+ }
+}
+
+impl Convert<u128, Balance> for CurrencyToVoteHandler {
+ fn convert(x: u128) -> Balance {
+ x * Self::factor()
+ }
+}
+
/// Re-export a nft pallet
/// TODO: Check this re-export. Is this safe and good style?
extern crate pallet_nft;
@@ -303,6 +329,213 @@
type FeeMultiplierUpdate = ();
}
+parameter_types! {
+ pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * MaximumBlockWeight::get();
+ pub const MaxScheduledPerBlock: u32 = 50;
+}
+
+impl pallet_scheduler::Trait for Runtime {
+ type Event = Event;
+ type Origin = Origin;
+ type PalletsOrigin = OriginCaller;
+ type Call = Call;
+ type MaximumWeight = MaximumSchedulerWeight;
+ type ScheduleOrigin = EnsureRoot<AccountId>;
+ type MaxScheduledPerBlock = MaxScheduledPerBlock;
+ type WeightInfo = ();
+}
+
+parameter_types! {
+ pub const ProposalBond: Permill = Permill::from_percent(5);
+ pub const ProposalBondMinimum: Balance = 1 * DOLLARS;
+ pub const SpendPeriod: BlockNumber = 1 * DAYS;
+ pub const Burn: Permill = Permill::from_percent(50);
+ pub const TipCountdown: BlockNumber = 1 * DAYS;
+ pub const TipFindersFee: Percent = Percent::from_percent(20);
+ pub const TipReportDepositBase: Balance = 1 * DOLLARS;
+ pub const DataDepositPerByte: Balance = 1 * CENTS;
+ pub const BountyDepositBase: Balance = 1 * DOLLARS;
+ pub const BountyDepositPayoutDelay: BlockNumber = 1 * DAYS;
+ pub const TreasuryModuleId: ModuleId = ModuleId(*b"py/trsry");
+ pub const BountyUpdatePeriod: BlockNumber = 14 * DAYS;
+ pub const MaximumReasonLength: u32 = 16384;
+ pub const BountyCuratorDeposit: Permill = Permill::from_percent(50);
+ pub const BountyValueMinimum: Balance = 5 * DOLLARS;
+}
+
+impl pallet_treasury::Trait for Runtime {
+ type ModuleId = TreasuryModuleId;
+ type Currency = Balances;
+ type ApproveOrigin =
+ EnsureOneOf<
+ AccountId,
+ EnsureRoot<AccountId>,
+ pallet_collective::EnsureMembers<_4, AccountId, CouncilCollective>
+ >;
+ type RejectOrigin =
+ EnsureOneOf<
+ AccountId,
+ EnsureRoot<AccountId>,
+ pallet_collective::EnsureMembers<_2, AccountId, CouncilCollective>
+ >;
+ type Tippers = Elections;
+ type TipCountdown = TipCountdown;
+ type TipFindersFee = TipFindersFee;
+ type TipReportDepositBase = TipReportDepositBase;
+ type DataDepositPerByte = DataDepositPerByte;
+ type Event = Event;
+ type OnSlash = ();
+ type ProposalBond = ProposalBond;
+ type ProposalBondMinimum = ProposalBondMinimum;
+ type SpendPeriod = SpendPeriod;
+ type Burn = Burn;
+ type BountyDepositBase = BountyDepositBase;
+ type BountyDepositPayoutDelay = BountyDepositPayoutDelay;
+ type BountyUpdatePeriod = BountyUpdatePeriod;
+ type BountyCuratorDeposit = BountyCuratorDeposit;
+ type BountyValueMinimum = BountyValueMinimum;
+ type MaximumReasonLength = MaximumReasonLength;
+ type BurnDestination = ();
+ type WeightInfo = ();
+}
+
+parameter_types! {
+ pub const TechnicalMotionDuration: BlockNumber = 5 * DAYS;
+ pub const TechnicalMaxProposals: u32 = 100;
+ pub const TechnicalMaxMembers: u32 = 100;
+}
+
+type TechnicalCollective = pallet_collective::Instance2;
+impl pallet_collective::Trait<TechnicalCollective> for Runtime {
+ type Origin = Origin;
+ type Proposal = Call;
+ type Event = Event;
+ type MotionDuration = TechnicalMotionDuration;
+ type MaxProposals = TechnicalMaxProposals;
+ type MaxMembers = TechnicalMaxMembers;
+ type DefaultVote = pallet_collective::PrimeDefaultVote;
+ type WeightInfo = ();
+}
+
+parameter_types! {
+ pub const LaunchPeriod: BlockNumber = 28 * 24 * 60 * MINUTES;
+ pub const VotingPeriod: BlockNumber = 28 * 24 * 60 * MINUTES;
+ pub const FastTrackVotingPeriod: BlockNumber = 3 * 24 * 60 * MINUTES;
+ pub const InstantAllowed: bool = true;
+ pub const MinimumDeposit: Balance = 100 * DOLLARS;
+ pub const EnactmentPeriod: BlockNumber = 30 * 24 * 60 * MINUTES;
+ pub const CooloffPeriod: BlockNumber = 28 * 24 * 60 * MINUTES;
+ // One cent: $10,000 / MB
+ pub const PreimageByteDeposit: Balance = 1 * CENTS;
+ pub const MaxVotes: u32 = 100;
+}
+
+impl pallet_democracy::Trait for Runtime {
+ type Proposal = Call;
+ type Event = Event;
+ type Currency = Balances;
+ type EnactmentPeriod = EnactmentPeriod;
+ type LaunchPeriod = LaunchPeriod;
+ type VotingPeriod = VotingPeriod;
+ type MinimumDeposit = MinimumDeposit;
+ /// A straight majority of the council can decide what their next motion is.
+ type ExternalOrigin = pallet_collective::EnsureProportionAtLeast<_1, _2, AccountId, CouncilCollective>;
+ /// A super-majority can have the next scheduled referendum be a straight majority-carries vote.
+ type ExternalMajorityOrigin = pallet_collective::EnsureProportionAtLeast<_3, _4, AccountId, CouncilCollective>;
+ /// A unanimous council can have the next scheduled referendum be a straight default-carries
+ /// (NTB) vote.
+ type ExternalDefaultOrigin = pallet_collective::EnsureProportionAtLeast<_1, _1, AccountId, CouncilCollective>;
+ /// Two thirds of the technical committee can have an ExternalMajority/ExternalDefault vote
+ /// be tabled immediately and with a shorter voting/enactment period.
+ type FastTrackOrigin = pallet_collective::EnsureProportionAtLeast<_2, _3, AccountId, TechnicalCollective>;
+ type InstantOrigin = pallet_collective::EnsureProportionAtLeast<_1, _1, AccountId, TechnicalCollective>;
+ type InstantAllowed = InstantAllowed;
+ type FastTrackVotingPeriod = FastTrackVotingPeriod;
+ // To cancel a proposal which has been passed, 2/3 of the council must agree to it.
+ type CancellationOrigin = EnsureOneOf<
+ AccountId,
+ EnsureRoot<AccountId>,
+ pallet_collective::EnsureProportionAtLeast<_2, _3, AccountId, CouncilCollective>,
+ >;
+ // Any single technical committee member may veto a coming council proposal, however they can
+ // only do it once and it lasts only for the cooloff period.
+ type VetoOrigin = pallet_collective::EnsureMember<AccountId, TechnicalCollective>;
+ type CooloffPeriod = CooloffPeriod;
+ type PreimageByteDeposit = PreimageByteDeposit;
+ type OperationalPreimageOrigin = pallet_collective::EnsureMember<AccountId, CouncilCollective>;
+ type Slash = Treasury;
+ type Scheduler = Scheduler;
+ type PalletsOrigin = OriginCaller;
+ type MaxVotes = MaxVotes;
+ type WeightInfo = (); //weights::pallet_democracy::WeightInfo;
+}
+
+parameter_types! {
+ pub const CouncilMotionDuration: BlockNumber = 5 * DAYS;
+ pub const CouncilMaxProposals: u32 = 100;
+ pub const CouncilMaxMembers: u32 = 100;
+}
+
+type CouncilCollective = pallet_collective::Instance1;
+impl pallet_collective::Trait<CouncilCollective> for Runtime {
+ type Origin = Origin;
+ type Proposal = Call;
+ type Event = Event;
+ type MotionDuration = CouncilMotionDuration;
+ type MaxProposals = CouncilMaxProposals;
+ type MaxMembers = CouncilMaxMembers;
+ type DefaultVote = pallet_collective::PrimeDefaultVote;
+ type WeightInfo = (); //weights::pallet_collective::WeightInfo;
+}
+
+parameter_types! {
+ pub const CandidacyBond: Balance = 10 * DOLLARS;
+ pub const VotingBond: Balance = 1 * DOLLARS;
+ pub const TermDuration: BlockNumber = 7 * DAYS;
+ pub const DesiredMembers: u32 = 13;
+ pub const DesiredRunnersUp: u32 = 7;
+ pub const ElectionsPhragmenModuleId: LockIdentifier = *b"phrelect";
+}
+
+// Make sure that there are no more than `MaxMembers` members elected via elections-phragmen.
+// const_assert!(DesiredMembers::get() <= CouncilMaxMembers::get());
+
+impl pallet_elections_phragmen::Trait for Runtime {
+ type Event = Event;
+ type ModuleId = ElectionsPhragmenModuleId;
+ type Currency = Balances;
+ type ChangeMembers = Council;
+ // NOTE: this implies that council's genesis members cannot be set directly and must come from
+ // this module.
+ type InitializeMembers = Council;
+ type CurrencyToVote = CurrencyToVoteHandler;
+ type CandidacyBond = CandidacyBond;
+ type VotingBond = VotingBond;
+ type LoserCandidate = ();
+ type BadReport = ();
+ type KickedMember = ();
+ type DesiredMembers = DesiredMembers;
+ type DesiredRunnersUp = DesiredRunnersUp;
+ type TermDuration = TermDuration;
+ type WeightInfo = (); //weights::pallet_elections_phragmen::WeightInfo;
+}
+
+type EnsureRootOrHalfCouncil = EnsureOneOf<
+ AccountId,
+ EnsureRoot<AccountId>,
+ pallet_collective::EnsureProportionMoreThan<_1, _2, AccountId, CouncilCollective>
+>;
+impl pallet_membership::Trait for Runtime {
+ type Event = Event;
+ type AddOrigin = EnsureRootOrHalfCouncil;
+ type RemoveOrigin = EnsureRootOrHalfCouncil;
+ type SwapOrigin = EnsureRootOrHalfCouncil;
+ type ResetOrigin = EnsureRootOrHalfCouncil;
+ type PrimeOrigin = EnsureRootOrHalfCouncil;
+ type MembershipInitialized = TechnicalCommittee;
+ type MembershipChanged = TechnicalCommittee;
+}
+
impl pallet_sudo::Trait for Runtime {
type Event = Event;
type Call = Call;
@@ -330,6 +563,14 @@
TransactionPayment: pallet_transaction_payment::{Module, Storage},
Sudo: pallet_sudo::{Module, Call, Config<T>, Storage, Event<T>},
Nft: pallet_nft::{Module, Call, Config<T>, Storage, Event<T>},
+
+ Democracy: pallet_democracy::{Module, Call, Storage, Config, Event<T>},
+ Council: pallet_collective::<Instance1>::{Module, Call, Storage, Origin<T>, Event<T>, Config<T>},
+ TechnicalCommittee: pallet_collective::<Instance2>::{Module, Call, Storage, Origin<T>, Event<T>, Config<T>},
+ Elections: pallet_elections_phragmen::{Module, Call, Storage, Event<T>, Config<T>},
+ TechnicalMembership: pallet_membership::{Module, Call, Storage, Event<T>, Config<T>},
+ Treasury: pallet_treasury::{Module, Call, Storage, Config, Event<T>},
+ Scheduler: pallet_scheduler::{Module, Call, Storage, Event<T>},
}
);