mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-15 16:11:05 +00:00
[big refactor] Remove crate aliasing. (#4395)
* Rename: Phase 1. * Unify codec. * Fixing: Phase 2 * Fixing: Phase 3. * Fixing: Phase 4. * Fixing: Phase 5. * Fixing: Phase 6. * Fixing: Phase 7. * Fixing: Phase 8. Tests * Fixing: Phase 9. Tests!!! * Fixing: Phase 10. Moar tests! * Finally done! * More fixes. * Rename primitives:: to sp_core:: * Apply renames in finality-grandpa. * Fix benches. * Fix benches 2. * Revert node-template. * Fix frame-system in our modules.
This commit is contained in:
committed by
Gavin Wood
parent
f14d98a439
commit
8778ca7dc8
@@ -107,13 +107,13 @@
|
||||
//! The Contract module uses the `Currency` trait to handle gas payment, and its types inherit from `Currency`:
|
||||
//!
|
||||
//! ```
|
||||
//! use support::traits::Currency;
|
||||
//! # pub trait Trait: system::Trait {
|
||||
//! use frame_support::traits::Currency;
|
||||
//! # pub trait Trait: frame_system::Trait {
|
||||
//! # type Currency: Currency<Self::AccountId>;
|
||||
//! # }
|
||||
//!
|
||||
//! pub type BalanceOf<T> = <<T as Trait>::Currency as Currency<<T as system::Trait>::AccountId>>::Balance;
|
||||
//! pub type NegativeImbalanceOf<T> = <<T as Trait>::Currency as Currency<<T as system::Trait>::AccountId>>::NegativeImbalance;
|
||||
//! pub type BalanceOf<T> = <<T as Trait>::Currency as Currency<<T as frame_system::Trait>::AccountId>>::Balance;
|
||||
//! pub type NegativeImbalanceOf<T> = <<T as Trait>::Currency as Currency<<T as frame_system::Trait>::AccountId>>::NegativeImbalance;
|
||||
//!
|
||||
//! # fn main() {}
|
||||
//! ```
|
||||
@@ -121,14 +121,14 @@
|
||||
//! The Staking module uses the `LockableCurrency` trait to lock a stash account's funds:
|
||||
//!
|
||||
//! ```
|
||||
//! use support::traits::{WithdrawReasons, LockableCurrency};
|
||||
//! use frame_support::traits::{WithdrawReasons, LockableCurrency};
|
||||
//! use sp_runtime::traits::Bounded;
|
||||
//! pub trait Trait: system::Trait {
|
||||
//! pub trait Trait: frame_system::Trait {
|
||||
//! type Currency: LockableCurrency<Self::AccountId, Moment=Self::BlockNumber>;
|
||||
//! }
|
||||
//! # struct StakingLedger<T: Trait> {
|
||||
//! # stash: <T as system::Trait>::AccountId,
|
||||
//! # total: <<T as Trait>::Currency as support::traits::Currency<<T as system::Trait>::AccountId>>::Balance,
|
||||
//! # stash: <T as frame_system::Trait>::AccountId,
|
||||
//! # total: <<T as Trait>::Currency as frame_support::traits::Currency<<T as frame_system::Trait>::AccountId>>::Balance,
|
||||
//! # phantom: std::marker::PhantomData<T>,
|
||||
//! # }
|
||||
//! # const STAKING_ID: [u8; 8] = *b"staking ";
|
||||
@@ -162,7 +162,7 @@
|
||||
use sp_std::prelude::*;
|
||||
use sp_std::{cmp, result, mem, fmt::Debug};
|
||||
use codec::{Codec, Encode, Decode};
|
||||
use support::{
|
||||
use frame_support::{
|
||||
StorageValue, Parameter, decl_event, decl_storage, decl_module,
|
||||
traits::{
|
||||
UpdateBalanceOutcome, Currency, OnFreeBalanceZero, OnUnbalanced, TryDrop,
|
||||
@@ -179,7 +179,7 @@ use sp_runtime::{
|
||||
Saturating, Bounded,
|
||||
},
|
||||
};
|
||||
use system::{IsDeadAccount, OnNewAccount, ensure_signed, ensure_root};
|
||||
use frame_system::{self as system, IsDeadAccount, OnNewAccount, ensure_signed, ensure_root};
|
||||
|
||||
#[cfg(test)]
|
||||
mod mock;
|
||||
@@ -188,7 +188,7 @@ mod tests;
|
||||
|
||||
pub use self::imbalances::{PositiveImbalance, NegativeImbalance};
|
||||
|
||||
pub trait Subtrait<I: Instance = DefaultInstance>: system::Trait {
|
||||
pub trait Subtrait<I: Instance = DefaultInstance>: frame_system::Trait {
|
||||
/// The balance of an account.
|
||||
type Balance: Parameter + Member + SimpleArithmetic + Codec + Default + Copy +
|
||||
MaybeSerializeDeserialize + Debug + From<Self::BlockNumber>;
|
||||
@@ -212,7 +212,7 @@ pub trait Subtrait<I: Instance = DefaultInstance>: system::Trait {
|
||||
type CreationFee: Get<Self::Balance>;
|
||||
}
|
||||
|
||||
pub trait Trait<I: Instance = DefaultInstance>: system::Trait {
|
||||
pub trait Trait<I: Instance = DefaultInstance>: frame_system::Trait {
|
||||
/// The balance of an account.
|
||||
type Balance: Parameter + Member + SimpleArithmetic + Codec + Default + Copy +
|
||||
MaybeSerializeDeserialize + Debug + From<Self::BlockNumber>;
|
||||
@@ -234,7 +234,7 @@ pub trait Trait<I: Instance = DefaultInstance>: system::Trait {
|
||||
type DustRemoval: OnUnbalanced<NegativeImbalance<Self, I>>;
|
||||
|
||||
/// The overarching event type.
|
||||
type Event: From<Event<Self, I>> + Into<<Self as system::Trait>::Event>;
|
||||
type Event: From<Event<Self, I>> + Into<<Self as frame_system::Trait>::Event>;
|
||||
|
||||
/// The minimum amount required to keep an account open.
|
||||
type ExistentialDeposit: Get<Self::Balance>;
|
||||
@@ -257,7 +257,7 @@ impl<T: Trait<I>, I: Instance> Subtrait<I> for T {
|
||||
|
||||
decl_event!(
|
||||
pub enum Event<T, I: Instance = DefaultInstance> where
|
||||
<T as system::Trait>::AccountId,
|
||||
<T as frame_system::Trait>::AccountId,
|
||||
<T as Trait<I>>::Balance
|
||||
{
|
||||
/// A new account was created.
|
||||
@@ -348,7 +348,7 @@ decl_storage! {
|
||||
/// is invoked, giving a chance to external modules to clean up data associated with
|
||||
/// the deleted account.
|
||||
///
|
||||
/// `system::AccountNonce` is also deleted if `ReservedBalance` is also zero (it also gets
|
||||
/// `frame_system::AccountNonce` is also deleted if `ReservedBalance` is also zero (it also gets
|
||||
/// collapsed to zero if it ever becomes less than `ExistentialDeposit`.
|
||||
pub FreeBalance get(fn free_balance)
|
||||
build(|config: &GenesisConfig<T, I>| config.balances.clone()):
|
||||
@@ -363,7 +363,7 @@ decl_storage! {
|
||||
/// When this balance falls below the value of `ExistentialDeposit`, then this 'reserve account'
|
||||
/// is deleted: specifically, `ReservedBalance`.
|
||||
///
|
||||
/// `system::AccountNonce` is also deleted if `FreeBalance` is also zero (it also gets
|
||||
/// `frame_system::AccountNonce` is also deleted if `FreeBalance` is also zero (it also gets
|
||||
/// collapsed to zero if it ever becomes less than `ExistentialDeposit`.)
|
||||
pub ReservedBalance get(fn reserved_balance): map T::AccountId => T::Balance;
|
||||
|
||||
@@ -439,7 +439,7 @@ decl_module! {
|
||||
/// This will alter `FreeBalance` and `ReservedBalance` in storage. it will
|
||||
/// also decrease the total issuance of the system (`TotalIssuance`).
|
||||
/// If the new free or reserved balance is below the existential deposit,
|
||||
/// it will reset the account nonce (`system::AccountNonce`).
|
||||
/// it will reset the account nonce (`frame_system::AccountNonce`).
|
||||
///
|
||||
/// The dispatch origin for this call is `root`.
|
||||
///
|
||||
@@ -565,7 +565,7 @@ impl<T: Trait<I>, I: Instance> Module<T, I> {
|
||||
///
|
||||
/// This just removes the nonce and leaves an event.
|
||||
fn reap_account(who: &T::AccountId) {
|
||||
<system::AccountNonce<T>>::remove(who);
|
||||
<frame_system::AccountNonce<T>>::remove(who);
|
||||
Self::deposit_event(RawEvent::ReapedAccount(who.clone()));
|
||||
}
|
||||
|
||||
@@ -781,7 +781,7 @@ impl<T: Subtrait<I>, I: Instance> PartialEq for ElevatedTrait<T, I> {
|
||||
fn eq(&self, _: &Self) -> bool { unimplemented!() }
|
||||
}
|
||||
impl<T: Subtrait<I>, I: Instance> Eq for ElevatedTrait<T, I> {}
|
||||
impl<T: Subtrait<I>, I: Instance> system::Trait for ElevatedTrait<T, I> {
|
||||
impl<T: Subtrait<I>, I: Instance> frame_system::Trait for ElevatedTrait<T, I> {
|
||||
type Origin = T::Origin;
|
||||
type Call = T::Call;
|
||||
type Index = T::Index;
|
||||
@@ -878,7 +878,7 @@ where
|
||||
return Ok(())
|
||||
}
|
||||
|
||||
let now = <system::Module<T>>::block_number();
|
||||
let now = <frame_system::Module<T>>::block_number();
|
||||
if locks.into_iter()
|
||||
.all(|l|
|
||||
now >= l.until
|
||||
@@ -1140,7 +1140,7 @@ where
|
||||
until: T::BlockNumber,
|
||||
reasons: WithdrawReasons,
|
||||
) {
|
||||
let now = <system::Module<T>>::block_number();
|
||||
let now = <frame_system::Module<T>>::block_number();
|
||||
let mut new_lock = Some(BalanceLock { id, amount, until, reasons });
|
||||
let mut locks = Self::locks(who).into_iter().filter_map(|l|
|
||||
if l.id == id {
|
||||
@@ -1163,7 +1163,7 @@ where
|
||||
until: T::BlockNumber,
|
||||
reasons: WithdrawReasons,
|
||||
) {
|
||||
let now = <system::Module<T>>::block_number();
|
||||
let now = <frame_system::Module<T>>::block_number();
|
||||
let mut new_lock = Some(BalanceLock { id, amount, until, reasons });
|
||||
let mut locks = Self::locks(who).into_iter().filter_map(|l|
|
||||
if l.id == id {
|
||||
@@ -1190,7 +1190,7 @@ where
|
||||
id: LockIdentifier,
|
||||
who: &T::AccountId,
|
||||
) {
|
||||
let now = <system::Module<T>>::block_number();
|
||||
let now = <frame_system::Module<T>>::block_number();
|
||||
let locks = Self::locks(who).into_iter().filter_map(|l|
|
||||
if l.until > now && l.id != id {
|
||||
Some(l)
|
||||
@@ -1211,7 +1211,7 @@ where
|
||||
fn vesting_balance(who: &T::AccountId) -> T::Balance {
|
||||
if let Some(v) = Self::vesting(who) {
|
||||
Self::free_balance(who)
|
||||
.min(v.locked_at(<system::Module<T>>::block_number()))
|
||||
.min(v.locked_at(<frame_system::Module<T>>::block_number()))
|
||||
} else {
|
||||
Zero::zero()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user