mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 04:41:02 +00:00
Council motions for approving treasury proposals (#694)
* Treasury in runtime, generic approve/reject * Add logic for council origin * Add tests. * Configurable number of members in EnsureMembers * Fix grumbles * Fix spelling * Comment
This commit is contained in:
@@ -35,6 +35,7 @@ extern crate serde_derive;
|
||||
extern crate serde;
|
||||
|
||||
extern crate substrate_codec as codec;
|
||||
extern crate substrate_primitives;
|
||||
|
||||
#[macro_use]
|
||||
extern crate substrate_codec_derive;
|
||||
@@ -49,6 +50,7 @@ extern crate substrate_runtime_session as session;
|
||||
extern crate substrate_runtime_staking as staking;
|
||||
extern crate substrate_runtime_system as system;
|
||||
extern crate substrate_runtime_timestamp as timestamp;
|
||||
extern crate substrate_runtime_treasury as treasury;
|
||||
#[macro_use]
|
||||
extern crate substrate_runtime_version as version;
|
||||
extern crate demo_primitives;
|
||||
@@ -57,9 +59,11 @@ use demo_primitives::{AccountId, AccountIndex, Balance, BlockNumber, Hash, Index
|
||||
use runtime_primitives::generic;
|
||||
use runtime_primitives::traits::{Convert, BlakeTwo256, DigestItem};
|
||||
use version::RuntimeVersion;
|
||||
use council::motions as council_motions;
|
||||
use substrate_primitives::u32_trait::{_2, _4};
|
||||
|
||||
#[cfg(any(feature = "std", test))]
|
||||
pub use runtime_primitives::BuildStorage;
|
||||
pub use runtime_primitives::{BuildStorage, Permill};
|
||||
|
||||
// Workaround for https://github.com/rust-lang/rust/issues/26925 . Remove when sorted.
|
||||
#[derive(Clone, Copy, PartialEq, Eq)]
|
||||
@@ -161,9 +165,27 @@ pub type Council = council::Module<Runtime>;
|
||||
/// Council voting module for this concrete runtime.
|
||||
pub type CouncilVoting = council::voting::Module<Runtime>;
|
||||
|
||||
impl council::motions::Trait for Runtime {
|
||||
type Origin = Origin;
|
||||
type Proposal = Call;
|
||||
type Event = Event;
|
||||
}
|
||||
|
||||
/// Council motions module for this concrete runtime.
|
||||
pub type CouncilMotions = council_motions::Module<Runtime>;
|
||||
|
||||
impl treasury::Trait for Runtime {
|
||||
type ApproveOrigin = council_motions::EnsureMembers<_4>;
|
||||
type RejectOrigin = council_motions::EnsureMembers<_2>;
|
||||
type Event = Event;
|
||||
}
|
||||
|
||||
/// Treasury module for this concrete runtime.
|
||||
pub type Treasury = treasury::Module<Runtime>;
|
||||
|
||||
impl_outer_event! {
|
||||
pub enum Event for Runtime {
|
||||
balances, session, staking, democracy
|
||||
balances, session, staking, democracy, treasury, council_motions
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,6 +197,7 @@ impl_outer_log! {
|
||||
|
||||
impl_outer_origin! {
|
||||
pub enum Origin for Runtime {
|
||||
council_motions
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,6 +211,8 @@ impl_outer_dispatch! {
|
||||
Democracy,
|
||||
Council,
|
||||
CouncilVoting,
|
||||
CouncilMotions,
|
||||
Treasury,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,6 +226,7 @@ impl_outer_config! {
|
||||
DemocracyConfig => democracy,
|
||||
CouncilConfig => council,
|
||||
TimestampConfig => timestamp,
|
||||
TreasuryConfig => treasury,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,7 +254,7 @@ pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Index, Call,
|
||||
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, Index, Call>;
|
||||
/// Executive: handles dispatch to the various modules.
|
||||
pub type Executive = executive::Executive<Runtime, Block, Balances, Balances,
|
||||
(((((), Council), Democracy), Staking), Session)>;
|
||||
((((((), Treasury), Council), Democracy), Staking), Session)>;
|
||||
|
||||
pub mod api {
|
||||
impl_stubs!(
|
||||
|
||||
Reference in New Issue
Block a user