Staking rate targeting and specific rewards. (#2882)

* PNPoS implementation

* wip: change staking api

* code readibility

* fix overflow

* comment

* license

* doc

* reorganize a bit

* rename to proper english + doc

* address comments

* refactor unused mock

* fix add_point

* update tests

* add not equalize to ci

* Revert "add not equalize to ci"

This reverts commit 1c61c25874b04b1cdfadd7d353b75a189a59ad35.

* bring test back

* update locks

* fix genesis config

* add authorship event handler + test

* uncouple timestamp from staking

* use on finalize instead

* remove todo

* simplify mock

* address comment

* doc

* merge test

* fmt

* remove todo todo

* move add_reward_point to regular function

* doc

* doc

* increase version

* doc and fmt

* Update srml/staking/src/inflation.rs

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>

* Fix some doc typos
This commit is contained in:
thiolliere
2019-07-24 19:25:43 +02:00
committed by Gavin Wood
parent 1c346d2190
commit 2b6f664caf
11 changed files with 711 additions and 206 deletions
+11 -1
View File
@@ -96,7 +96,8 @@ use parity_codec::Encode;
use parity_codec::Decode;
#[cfg(feature = "std")]
use inherents::ProvideInherentData;
use srml_support::{StorageValue, Parameter, decl_storage, decl_module, for_each_tuple, traits::Get};
use srml_support::{StorageValue, Parameter, decl_storage, decl_module, for_each_tuple};
use srml_support::traits::{Time, Get};
use runtime_primitives::traits::{SimpleArithmetic, Zero, SaturatedConversion};
use system::ensure_none;
use inherents::{RuntimeString, InherentIdentifier, ProvideInherent, IsFatalError, InherentData};
@@ -321,6 +322,15 @@ impl<T: Trait> ProvideInherent for Module<T> {
}
}
impl<T: Trait> Time for Module<T> {
type Moment = T::Moment;
/// Before the first set of now with inherent the value returned is zero.
fn now() -> Self::Moment {
Self::now()
}
}
#[cfg(test)]
mod tests {
use super::*;