Skip to content
Closed

Gov2 #1762

Show file tree
Hide file tree
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
54 changes: 54 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions runtime/moonbase/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,13 @@ frame-system-rpc-runtime-api = { git = "https://github.com/purestake/substrate",
pallet-assets = { git = "https://github.com/purestake/substrate", branch = "moonbeam-polkadot-v0.9.26", default-features = false }
pallet-balances = { git = "https://github.com/purestake/substrate", branch = "moonbeam-polkadot-v0.9.26", default-features = false }
pallet-collective = { git = "https://github.com/purestake/substrate", branch = "moonbeam-polkadot-v0.9.26", default-features = false }
pallet-conviction-voting = { git = "https://github.com/purestake/substrate", branch = "moonbeam-polkadot-v0.9.26", default-features = false }
pallet-democracy = { git = "https://github.com/purestake/substrate", branch = "moonbeam-polkadot-v0.9.26", default-features = false }
pallet-identity = { git = "https://github.com/purestake/substrate", branch = "moonbeam-polkadot-v0.9.26", default-features = false }
pallet-preimage = { git = "https://github.com/purestake/substrate", branch = "moonbeam-polkadot-v0.9.26", default-features = false }
pallet-proxy = { git = "https://github.com/purestake/substrate", branch = "moonbeam-polkadot-v0.9.26", default-features = false }
pallet-randomness-collective-flip = { git = "https://github.com/purestake/substrate", branch = "moonbeam-polkadot-v0.9.26", default-features = false }
pallet-referenda = { git = "https://github.com/purestake/substrate", branch = "moonbeam-polkadot-v0.9.26", default-features = false }
pallet-scheduler = { git = "https://github.com/purestake/substrate", branch = "moonbeam-polkadot-v0.9.26", default-features = false }
pallet-society = { git = "https://github.com/purestake/substrate", branch = "moonbeam-polkadot-v0.9.26", default-features = false }
pallet-sudo = { git = "https://github.com/purestake/substrate", branch = "moonbeam-polkadot-v0.9.26", default-features = false }
Expand All @@ -82,9 +85,11 @@ pallet-transaction-payment = { git = "https://github.com/purestake/substrate", b
pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/purestake/substrate", branch = "moonbeam-polkadot-v0.9.26", default-features = false }
pallet-treasury = { git = "https://github.com/purestake/substrate", branch = "moonbeam-polkadot-v0.9.26", default-features = false }
pallet-utility = { git = "https://github.com/purestake/substrate", branch = "moonbeam-polkadot-v0.9.26", default-features = false }
pallet-whitelist = { git = "https://github.com/purestake/substrate", branch = "moonbeam-polkadot-v0.9.26", default-features = false }
parity-scale-codec = { version = "3.0.0", default-features = false, features = [ "derive", "max-encoded-len" ] }
scale-info = { version = "2.0", default-features = false, features = [ "derive" ] }
sp-api = { git = "https://github.com/purestake/substrate", branch = "moonbeam-polkadot-v0.9.26", default-features = false }
sp-arithmetic = { git = "https://github.com/purestake/substrate", branch = "moonbeam-polkadot-v0.9.26", default-features = false }
sp-block-builder = { git = "https://github.com/purestake/substrate", branch = "moonbeam-polkadot-v0.9.26", default-features = false }
sp-core = { git = "https://github.com/purestake/substrate", branch = "moonbeam-polkadot-v0.9.26", default-features = false }
sp-debug-derive = { git = "https://github.com/purestake/substrate", branch = "moonbeam-polkadot-v0.9.26", default-features = false }
Expand Down Expand Up @@ -190,6 +195,7 @@ std = [
"pallet-balances/std",
"pallet-base-fee/std",
"pallet-collective/std",
"pallet-conviction-voting/std",
"pallet-crowdloan-rewards/std",
"pallet-democracy/std",
"pallet-ethereum-chain-id/std",
Expand All @@ -213,10 +219,12 @@ std = [
"pallet-migrations/std",
"pallet-moonbeam-orbiters/std",
"pallet-parachain-staking/std",
"pallet-preimage/std",
"pallet-proxy-genesis-companion/std",
"pallet-proxy/std",
"pallet-randomness-collective-flip/std",
"pallet-randomness/std",
"pallet-referenda/std",
"pallet-scheduler/std",
"pallet-society/std",
"pallet-sudo/std",
Expand All @@ -225,6 +233,7 @@ std = [
"pallet-transaction-payment/std",
"pallet-treasury/std",
"pallet-utility/std",
"pallet-whitelist/std",
"pallet-xcm-transactor/std",
"pallet-xcm/std",
"parachain-info/std",
Expand All @@ -234,6 +243,7 @@ std = [
"serde",
"session-keys-primitives/std",
"sp-api/std",
"sp-arithmetic/std",
"sp-block-builder/std",
"sp-core/std",
"sp-inherents/std",
Expand Down Expand Up @@ -277,12 +287,14 @@ runtime-benchmarks = [
"pallet-author-slot-filter/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-collective/runtime-benchmarks",
"pallet-conviction-voting/runtime-benchmarks",
"pallet-crowdloan-rewards/runtime-benchmarks",
"pallet-ethereum-xcm/runtime-benchmarks",
"pallet-ethereum/runtime-benchmarks",
"pallet-moonbeam-orbiters/runtime-benchmarks",
"pallet-parachain-staking/runtime-benchmarks",
"pallet-randomness/runtime-benchmarks",
"pallet-referenda/runtime-benchmarks",
"pallet-society/runtime-benchmarks",
"pallet-timestamp/runtime-benchmarks",
"pallet-xcm-transactor/runtime-benchmarks",
Expand All @@ -301,11 +313,13 @@ try-runtime = [
"pallet-author-slot-filter/try-runtime",
"pallet-balances/try-runtime",
"pallet-collective/try-runtime",
"pallet-conviction-voting/try-runtime",
"pallet-maintenance-mode/try-runtime",
#"pallet-crowdloan-rewards/try-runtime",
"pallet-maintenance-mode/try-runtime",
"pallet-migrations/try-runtime",
"pallet-parachain-staking/try-runtime",
"pallet-referenda/try-runtime",
"pallet-scheduler/try-runtime",
"pallet-society/try-runtime",
"pallet-timestamp/try-runtime",
Expand Down
88 changes: 88 additions & 0 deletions runtime/moonbase/src/governance/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
// Copyright 2019-2022 PureStake Inc.
// This file is part of Moonbeam.

// Moonbeam is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// Moonbeam is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Moonbeam. If not, see <http://www.gnu.org/licenses/>.

//! New governance configurations for the Moonbase runtime.

use super::*;
use crate::currency::*;
use frame_support::traits::EitherOf;
use frame_system::EnsureRootWithSuccess;

mod origins;
pub use origins::{
pallet_custom_origins, GeneralAdmin, ReferendumCanceller, ReferendumKiller, Spender,
WhitelistedCaller,
};
mod tracks;
pub use tracks::TracksInfo;

parameter_types! {
pub const VoteLockingPeriod: BlockNumber = 7 * DAYS;
}

impl pallet_conviction_voting::Config for Runtime {
type WeightInfo = pallet_conviction_voting::weights::SubstrateWeight<Runtime>;
type Event = Event;
type Currency = Balances;
type VoteLockingPeriod = VoteLockingPeriod;
type MaxVotes = ConstU32<512>;
type MaxTurnout = frame_support::traits::TotalIssuanceOf<Balances, Self::AccountId>;
type Polls = Referenda;
}

parameter_types! {
pub const AlarmInterval: BlockNumber = 1;
pub const SubmissionDeposit: Balance = 100 * UNIT;
pub const UndecidingTimeout: BlockNumber = 28 * DAYS;
}

parameter_types! {
pub const MaxBalance: Balance = Balance::max_value();
}
pub type TreasurySpender = EitherOf<EnsureRootWithSuccess<AccountId, MaxBalance>, Spender>;

impl origins::pallet_custom_origins::Config for Runtime {}

// purpose of this pallet is to queue calls to be dispatched as root for later
impl pallet_whitelist::Config for Runtime {
type WeightInfo = pallet_whitelist::weights::SubstrateWeight<Runtime>;
type Event = Event;
type Call = Call;
// polkadot: EitherOf<EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>, Fellows>;
type WhitelistOrigin =
EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>, TODO: COLLECTIVE>;
type DispatchWhitelistedOrigin = EitherOf<EnsureRoot<Self::AccountId>, WhitelistedCaller>;
type PreimageProvider = Preimage;
}

impl pallet_referenda::Config for Runtime {
type WeightInfo = pallet_referenda::weights::SubstrateWeight<Runtime>;
type Call = Call;
type Event = Event;
type Scheduler = Scheduler;
type Currency = Balances;
type SubmitOrigin = frame_system::EnsureSigned<AccountId>;
type CancelOrigin = ReferendumCanceller;
type KillOrigin = ReferendumKiller;
type Slash = Treasury;
type Votes = pallet_conviction_voting::VotesOf<Runtime>;
type Tally = pallet_conviction_voting::TallyOf<Runtime>;
type SubmissionDeposit = SubmissionDeposit;
type MaxQueued = ConstU32<100>;
type UndecidingTimeout = UndecidingTimeout;
type AlarmInterval = AlarmInterval;
type Tracks = TracksInfo;
}
1 change: 1 addition & 0 deletions runtime/moonbase/src/governance/old.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//! old governance configurations
Loading