-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: Basic governance config for InvArch
- Loading branch information
Showing
9 changed files
with
608 additions
and
15 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
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,30 @@ | ||
//! Councils for Governance | ||
use super::*; | ||
|
||
pub type TinkerCouncil = pallet_collective::Instance1; | ||
|
||
parameter_types! { | ||
pub MaxProposalWeight: Weight = Perbill::from_percent(50) * RuntimeBlockWeights::get().max_block; | ||
pub MaxMotionDuration: u32 = 3 * DAYS ; | ||
pub MaxProposals: u32 = 20; | ||
pub MaxMembers: u32 = 5; | ||
|
||
} | ||
|
||
impl pallet_collective::Config<TinkerCouncil> for Runtime { | ||
type RuntimeOrigin = RuntimeOrigin; | ||
type RuntimeEvent = RuntimeEvent; | ||
type Proposal = RuntimeCall; | ||
/// The maximum amount of time (in blocks) council members to vote on motions. | ||
/// Motions may end in fewer blocks if enough votes are cast to determine the result. | ||
type MotionDuration = MaxMotionDuration; | ||
/// The maximum number of proposals that can be open in council at once. | ||
type MaxProposals = MaxProposals; | ||
/// The maximum number of council members. | ||
type MaxMembers = MaxMembers; | ||
type DefaultVote = pallet_collective::MoreThanMajorityThenPrimeDefaultVote; | ||
type WeightInfo = pallet_collective::weights::SubstrateWeight<Runtime>; | ||
type SetMembersOrigin = EitherOf<CouncilApproveOrigin, CouncilAdmin>; | ||
type MaxProposalWeight = MaxProposalWeight; | ||
} |
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,86 @@ | ||
use self::councils::TinkerCouncil; | ||
|
||
use super::*; | ||
// use crate::xcm_config::CollectivesLocation; | ||
use frame_support::{parameter_types, traits::EitherOf}; | ||
|
||
use frame_system::EnsureRootWithSuccess; | ||
|
||
mod origins; | ||
pub use origins::{ | ||
pallet_custom_origins, CouncilAdmin, GeneralManagement, ReferendumCanceller, ReferendumKiller, | ||
Spender, WhitelistedCaller, | ||
}; | ||
mod tracks; | ||
pub use tracks::TracksInfo; | ||
|
||
mod councils; | ||
|
||
parameter_types! { | ||
pub const VoteLockingPeriod: BlockNumber = 7 * DAYS; | ||
} | ||
|
||
impl pallet_conviction_voting::Config for Runtime { | ||
type WeightInfo = pallet_conviction_voting::weights::SubstrateWeight<Runtime>; | ||
type RuntimeEvent = RuntimeEvent; | ||
type Currency = Balances; | ||
type VoteLockingPeriod = VoteLockingPeriod; | ||
type MaxVotes = ConstU32<512>; | ||
type MaxTurnout = | ||
frame_support::traits::tokens::currency::ActiveIssuanceOf<Balances, Self::AccountId>; | ||
type Polls = Referenda; | ||
} | ||
|
||
parameter_types! { | ||
pub const AlarmInterval: BlockNumber = 1; | ||
pub const SubmissionDeposit: Balance = UNIT; | ||
pub const UndecidingTimeout: BlockNumber = 14 * DAYS; | ||
} | ||
|
||
parameter_types! { | ||
pub const MaxBalance: Balance = Balance::max_value(); | ||
} | ||
|
||
pub type AllCouncil = pallet_collective::EnsureProportionAtLeast<AccountId, TinkerCouncil, 1, 1>; | ||
pub type CouncilMoreThanApprove = | ||
pallet_collective::EnsureProportionMoreThan<AccountId, TinkerCouncil, 3, 5>; | ||
pub type ConcilHalf = pallet_collective::EnsureProportionAtLeast<AccountId, TinkerCouncil, 1, 2>; | ||
pub type CouncilThreeFifths = | ||
pallet_collective::EnsureProportionAtLeast<AccountId, TinkerCouncil, 3, 5>; | ||
|
||
pub type TreasurySpender = EitherOf<EnsureRootWithSuccess<AccountId, MaxBalance>, Spender>; | ||
pub type RootOrGeneralManagement = EitherOf<EnsureRoot<AccountId>, GeneralManagement>; | ||
pub type CouncilApproveOrigin = EitherOf<EnsureRoot<AccountId>, CouncilThreeFifths>; | ||
pub type CouncilRejectOrigin = EitherOf<EnsureRoot<AccountId>, ConcilHalf>; | ||
|
||
impl pallet_custom_origins::Config for Runtime {} | ||
|
||
impl pallet_whitelist::Config for Runtime { | ||
type WeightInfo = pallet_whitelist::weights::SubstrateWeight<Runtime>; | ||
type RuntimeCall = RuntimeCall; | ||
type RuntimeEvent = RuntimeEvent; | ||
type WhitelistOrigin = CouncilApproveOrigin; | ||
type DispatchWhitelistedOrigin = EitherOf<EnsureRoot<Self::AccountId>, WhitelistedCaller>; | ||
type Preimages = Preimage; | ||
} | ||
|
||
impl pallet_referenda::Config for Runtime { | ||
type WeightInfo = pallet_referenda::weights::SubstrateWeight<Runtime>; | ||
type RuntimeCall = RuntimeCall; | ||
type RuntimeEvent = RuntimeEvent; | ||
type Scheduler = Scheduler; | ||
type Currency = Balances; | ||
type SubmitOrigin = frame_system::EnsureSigned<AccountId>; | ||
type CancelOrigin = | ||
EitherOf<EitherOf<EnsureRoot<AccountId>, ReferendumCanceller>, CouncilMoreThanApprove>; | ||
type KillOrigin = EitherOf<EitherOf<EnsureRoot<AccountId>, ReferendumKiller>, AllCouncil>; | ||
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; | ||
type Preimages = Preimage; | ||
} |
Oops, something went wrong.