forked from moonbeam-foundation/moonbeam
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds Governance v2 (moonbase only) (moonbeam-foundation#1838)
* move democracy to old and councils to own file until decided how to migrate councils * fix * Gov2 (moonbeam-foundation#1839) * gov2 config init with whitelist origin configured with tech committee 2 of 3 * test * clean * fix and docs * fix * try fix * try fix * fix and clean * fix * fix test and add curve docs above curves * revert accidental change * give power to Treasurer and rename GeneralAdmin to IdentityAdmin * finish rename of general admin to identity admin as it only manages the identity registrar * accept suggestion to use SUPPLY FACTOR in Spender definition * use supply factor for all currency * fix import * Playing with tracks values * fix build and update tracks curve evolution gist * update track curve format * improve * Configure referendum tracks Co-authored-by: Crystalin <alan@purestake.com>
- Loading branch information
Showing
9 changed files
with
684 additions
and
104 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// 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/>. | ||
|
||
//! Councils for Gov1 | ||
use super::*; | ||
|
||
pub type CouncilInstance = pallet_collective::Instance1; | ||
pub type TechCommitteeInstance = pallet_collective::Instance2; | ||
pub type TreasuryCouncilInstance = pallet_collective::Instance3; | ||
|
||
impl pallet_collective::Config<CouncilInstance> for Runtime { | ||
type Origin = Origin; | ||
type Event = Event; | ||
type Proposal = Call; | ||
/// The maximum amount of time (in blocks) for council members to vote on motions. | ||
/// Motions may end in fewer blocks if enough votes are cast to determine the result. | ||
type MotionDuration = ConstU32<{ 3 * DAYS }>; | ||
/// The maximum number of proposals that can be open in the council at once. | ||
type MaxProposals = ConstU32<100>; | ||
/// The maximum number of council members. | ||
type MaxMembers = ConstU32<100>; | ||
type DefaultVote = pallet_collective::MoreThanMajorityThenPrimeDefaultVote; | ||
type WeightInfo = pallet_collective::weights::SubstrateWeight<Runtime>; | ||
} | ||
|
||
impl pallet_collective::Config<TechCommitteeInstance> for Runtime { | ||
type Origin = Origin; | ||
type Event = Event; | ||
type Proposal = Call; | ||
/// The maximum amount of time (in blocks) for technical committee members to vote on motions. | ||
/// Motions may end in fewer blocks if enough votes are cast to determine the result. | ||
type MotionDuration = ConstU32<{ 3 * DAYS }>; | ||
/// The maximum number of proposals that can be open in the technical committee at once. | ||
type MaxProposals = ConstU32<100>; | ||
/// The maximum number of technical committee members. | ||
type MaxMembers = ConstU32<100>; | ||
type DefaultVote = pallet_collective::MoreThanMajorityThenPrimeDefaultVote; | ||
type WeightInfo = pallet_collective::weights::SubstrateWeight<Runtime>; | ||
} | ||
|
||
impl pallet_collective::Config<TreasuryCouncilInstance> for Runtime { | ||
type Origin = Origin; | ||
type Event = Event; | ||
type Proposal = Call; | ||
/// The maximum amount of time (in blocks) for treasury council members to vote on motions. | ||
/// Motions may end in fewer blocks if enough votes are cast to determine the result. | ||
type MotionDuration = ConstU32<{ 3 * DAYS }>; | ||
/// The maximum number of proposals that can be open in the treasury council at once. | ||
type MaxProposals = ConstU32<20>; | ||
/// The maximum number of treasury council members. | ||
type MaxMembers = ConstU32<9>; | ||
type DefaultVote = pallet_collective::MoreThanMajorityThenPrimeDefaultVote; | ||
type WeightInfo = pallet_collective::weights::SubstrateWeight<Runtime>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// 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/>. | ||
|
||
//! Democracy config for Gov1 | ||
use super::councils::*; | ||
use crate::*; | ||
|
||
// The purpose of this offset is to ensure that a democratic proposal will not apply in the same | ||
// block as a round change. | ||
const ENACTMENT_OFFSET: u32 = 300; | ||
|
||
impl pallet_democracy::Config for Runtime { | ||
type Proposal = Call; | ||
type Event = Event; | ||
type Currency = Balances; | ||
type EnactmentPeriod = ConstU32<{ 1 * DAYS + ENACTMENT_OFFSET }>; | ||
type LaunchPeriod = ConstU32<{ 1 * DAYS }>; | ||
type VotingPeriod = ConstU32<{ 5 * DAYS }>; | ||
type VoteLockingPeriod = ConstU32<{ 1 * DAYS }>; | ||
type FastTrackVotingPeriod = ConstU32<{ 4 * HOURS }>; | ||
type MinimumDeposit = ConstU128<{ 4 * currency::UNIT * currency::SUPPLY_FACTOR }>; | ||
/// To decide what their next motion is. | ||
type ExternalOrigin = | ||
pallet_collective::EnsureProportionAtLeast<AccountId, CouncilInstance, 1, 2>; | ||
/// To have the next scheduled referendum be a straight majority-carries vote. | ||
type ExternalMajorityOrigin = | ||
pallet_collective::EnsureProportionAtLeast<AccountId, CouncilInstance, 3, 5>; | ||
/// To have the next scheduled referendum be a straight default-carries (NTB) vote. | ||
type ExternalDefaultOrigin = | ||
pallet_collective::EnsureProportionAtLeast<AccountId, CouncilInstance, 3, 5>; | ||
/// To allow a shorter voting/enactment period for external proposals. | ||
type FastTrackOrigin = | ||
pallet_collective::EnsureProportionAtLeast<AccountId, TechCommitteeInstance, 1, 2>; | ||
/// To instant fast track. | ||
type InstantOrigin = | ||
pallet_collective::EnsureProportionAtLeast<AccountId, TechCommitteeInstance, 3, 5>; | ||
// To cancel a proposal which has been passed. | ||
type CancellationOrigin = EitherOfDiverse< | ||
EnsureRoot<AccountId>, | ||
pallet_collective::EnsureProportionAtLeast<AccountId, CouncilInstance, 3, 5>, | ||
>; | ||
// To cancel a proposal before it has been passed. | ||
type CancelProposalOrigin = EitherOfDiverse< | ||
EnsureRoot<AccountId>, | ||
pallet_collective::EnsureProportionAtLeast<AccountId, TechCommitteeInstance, 3, 5>, | ||
>; | ||
type BlacklistOrigin = EnsureRoot<AccountId>; | ||
// 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, TechCommitteeInstance>; | ||
type CooloffPeriod = ConstU32<{ 7 * DAYS }>; | ||
type PreimageByteDeposit = ConstU128<{ currency::STORAGE_BYTE_FEE }>; | ||
type Slash = (); | ||
type InstantAllowed = ConstBool<true>; | ||
type Scheduler = Scheduler; | ||
type MaxVotes = ConstU32<100>; | ||
type OperationalPreimageOrigin = pallet_collective::EnsureMember<AccountId, CouncilInstance>; | ||
type PalletsOrigin = OriginCaller; | ||
type WeightInfo = pallet_democracy::weights::SubstrateWeight<Runtime>; | ||
type MaxProposals = ConstU32<100>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// 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/>. | ||
|
||
//! Governance configurations | ||
pub mod councils; | ||
mod democracy; | ||
pub mod referenda; | ||
|
||
use super::*; | ||
|
||
mod origins; | ||
pub use origins::{ | ||
pallet_custom_origins, ReferendumCanceller, ReferendumKiller, Spender, WhitelistedCaller, | ||
}; | ||
mod tracks; | ||
pub use tracks::TracksInfo; |
Oops, something went wrong.