Make constants exposable in metadata (#2975)

* Some cleanup

* Add module constant metadata declaration

* Begin to integrate the constants in `decl_module`

* Fixes tests

* Fix compilation and add tests

* Remove duplicate code

* Expose constants in democracy and staking + further fixes

* Update srml/metadata/src/lib.rs

Co-Authored-By: YJ <yjkimjunior@gmail.com>

* Hide `RawEvent` metadata function

* Prevent whitespaces in types

* Fix `offchain_worker` and `constants` with instances

* Up the `impl_version`

* Fix macro

* Incrase impl_version
This commit is contained in:
Bastian Köcher
2019-07-01 10:05:28 +02:00
committed by GitHub
parent 5f1538b834
commit 7202403bfc
12 changed files with 858 additions and 580 deletions
+22 -1
View File
@@ -241,7 +241,6 @@ impl<BlockNumber: Parameter, Proposal: Parameter> ReferendumInfo<BlockNumber, Pr
decl_storage! {
trait Store for Module<T: Trait> as Democracy {
/// The number of (public) proposals that have been made so far.
pub PublicPropCount get(public_prop_count) build(|_| 0 as PropIndex) : PropIndex;
/// The public proposals. Unsorted.
@@ -318,6 +317,28 @@ decl_event!(
decl_module! {
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
/// The minimum period of locking and the period between a proposal being approved and enacted.
///
/// It should generally be a little more than the unstake period to ensure that
/// voting stakers have an opportunity to remove themselves from the system in the case where
/// they are on the losing side of a vote.
const EnactmentPeriod: T::BlockNumber = T::EnactmentPeriod::get();
/// How often (in blocks) new public referenda are launched.
const LaunchPeriod: T::BlockNumber = T::LaunchPeriod::get();
/// How often (in blocks) to check for new votes.
const VotingPeriod: T::BlockNumber = T::VotingPeriod::get();
/// The minimum amount to be used as a deposit for a public referendum proposal.
const MinimumDeposit: BalanceOf<T> = T::MinimumDeposit::get();
/// Minimum voting period allowed for an emergency referendum.
const EmergencyVotingPeriod: T::BlockNumber = T::EmergencyVotingPeriod::get();
/// Period in blocks where an external proposal may not be re-submitted after being vetoed.
const CooloffPeriod: T::BlockNumber = T::CooloffPeriod::get();
fn deposit_event<T>() = default;
/// Propose a sensitive action to be taken.