mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 21:01:05 +00:00
Improve fees module (#1821)
* remove amount associated * make a new trait to bound some arithmetics to balances or assets: It also remove arithmetic bounds of srml-support::traits::Currency. To update your code then use srml_support::traits::ArithmeticType like: `type Currency: ArithmeticType + Currency<Self::AccountId, Balance=BalanceOf<Self>>; ` with `type BalanceOf<T> = <<T as Trait>::Currency as ArithmeticType>::Type; ` * improve decl_storage when it explicit serde bound: basically don't try to be smarter than rust and just use where clause.
This commit is contained in:
@@ -25,7 +25,7 @@ use parity_codec::HasCompact;
|
||||
use parity_codec_derive::{Encode, Decode};
|
||||
use srml_support::{Parameter, StorageValue, StorageMap, dispatch::Result};
|
||||
use srml_support::{decl_module, decl_event, decl_storage, ensure};
|
||||
use srml_support::traits::{Currency, OnDilution, EnsureAccountLiquid, OnFreeBalanceZero};
|
||||
use srml_support::traits::{Currency, OnDilution, EnsureAccountLiquid, OnFreeBalanceZero, ArithmeticType};
|
||||
use session::OnSessionChange;
|
||||
use primitives::Perbill;
|
||||
use primitives::traits::{Zero, One, Bounded, As, StaticLookup};
|
||||
@@ -67,11 +67,11 @@ impl<B: Default + HasCompact + Copy> Default for ValidatorPrefs<B> {
|
||||
}
|
||||
}
|
||||
|
||||
type BalanceOf<T> = <<T as Trait>::Currency as Currency<<T as system::Trait>::AccountId>>::Balance;
|
||||
type BalanceOf<T> = <<T as Trait>::Currency as ArithmeticType>::Type;
|
||||
|
||||
pub trait Trait: system::Trait + session::Trait {
|
||||
/// The staking balance.
|
||||
type Currency: Currency<Self::AccountId>;
|
||||
type Currency: ArithmeticType + Currency<Self::AccountId, Balance=BalanceOf<Self>>;
|
||||
|
||||
/// Some tokens minted.
|
||||
type OnRewardMinted: OnDilution<BalanceOf<Self>>;
|
||||
|
||||
Reference in New Issue
Block a user