Per-things trait. (#4904)

* Give perthigns the trait it always deserved.

* Make staking and phragmen work with the new generic per_thing

* Make everything work together 🔨

* a bit of cleanup

* Clean usage

* Bump.

* Fix name

* fix grumbles

* hopefully fix the ui test

* Some grumbles

* revamp traits again

* Better naming again.
This commit is contained in:
Kian Paimani
2020-02-13 13:09:33 +01:00
committed by GitHub
parent e6454eb091
commit c871eaacbc
42 changed files with 346 additions and 241 deletions
+4 -4
View File
@@ -24,7 +24,7 @@ use sp_core::u32_trait::Value as U32;
use sp_runtime::{
RuntimeDebug,
ConsensusEngineId, DispatchResult, DispatchError,
traits::{MaybeSerializeDeserialize, SimpleArithmetic, Saturating, TrailingZeroInput},
traits::{MaybeSerializeDeserialize, AtLeast32Bit, Saturating, TrailingZeroInput},
};
use crate::dispatch::Parameter;
@@ -267,7 +267,7 @@ pub enum SignedImbalance<B, P: Imbalance<B>>{
impl<
P: Imbalance<B, Opposite=N>,
N: Imbalance<B, Opposite=P>,
B: SimpleArithmetic + FullCodec + Copy + MaybeSerializeDeserialize + Debug + Default,
B: AtLeast32Bit + FullCodec + Copy + MaybeSerializeDeserialize + Debug + Default,
> SignedImbalance<B, P> {
pub fn zero() -> Self {
SignedImbalance::Positive(P::zero())
@@ -330,7 +330,7 @@ impl<
/// Abstraction over a fungible assets system.
pub trait Currency<AccountId> {
/// The balance of an account.
type Balance: SimpleArithmetic + FullCodec + Copy + MaybeSerializeDeserialize + Debug + Default;
type Balance: AtLeast32Bit + FullCodec + Copy + MaybeSerializeDeserialize + Debug + Default;
/// The opaque token type for an imbalance. This is returned by unbalanced operations
/// and must be dealt with. It may be dropped but cannot be cloned.
@@ -659,7 +659,7 @@ bitmask! {
}
pub trait Time {
type Moment: SimpleArithmetic + Parameter + Default + Copy;
type Moment: AtLeast32Bit + Parameter + Default + Copy;
fn now() -> Self::Moment;
}