79
79
//! - [`ReservableCurrency`](frame_support::traits::ReservableCurrency):
80
80
//! - [`NamedReservableCurrency`](frame_support::traits::NamedReservableCurrency):
81
81
//! Functions for dealing with assets that can be reserved from an account.
82
- //! - [`Lockable `](frame_support::traits::fungibles::Lockable ): Functions for
82
+ //! - [`LockableCurrency `](frame_support::traits::LockableCurrency ): Functions for
83
83
//! dealing with accounts that allow liquidity restrictions.
84
84
//! - [`Imbalance`](frame_support::traits::Imbalance): Functions for handling
85
85
//! imbalances between total issuance in the system and account balances. Must be used when a
113
113
//! # fn main() {}
114
114
//! ```
115
115
//!
116
- //! The Staking pallet uses the `fungibles::Lockable ` trait to lock a stash account's funds:
116
+ //! The Staking pallet uses the `LockableCurrency ` trait to lock a stash account's funds:
117
117
//!
118
118
//! ```
119
- //! use frame_support::traits::{WithdrawReasons, fungibles, fungibles::Lockable };
119
+ //! use frame_support::traits::{WithdrawReasons, LockableCurrency };
120
120
//! use sp_runtime::traits::Bounded;
121
121
//! pub trait Config: frame_system::Config {
122
- //! type Currency: fungibles::Lockable <Self::AccountId, Moment=Self::BlockNumber>;
122
+ //! type Currency: LockableCurrency <Self::AccountId, Moment=Self::BlockNumber>;
123
123
//! }
124
124
//! # struct StakingLedger<T: Config> {
125
125
//! # stash: <T as frame_system::Config>::AccountId,
@@ -171,13 +171,11 @@ use frame_support::{
171
171
ensure,
172
172
pallet_prelude:: DispatchResult ,
173
173
traits:: {
174
- tokens:: {
175
- fungible, fungibles, BalanceStatus as Status , DepositConsequence , WithdrawConsequence ,
176
- } ,
174
+ tokens:: { fungible, BalanceStatus as Status , DepositConsequence , WithdrawConsequence } ,
177
175
Currency , DefensiveSaturating , ExistenceRequirement ,
178
176
ExistenceRequirement :: { AllowDeath , KeepAlive } ,
179
- Get , Imbalance , NamedReservableCurrency , OnUnbalanced , ReservableCurrency , SignedImbalance ,
180
- StoredMap , TryDrop , WithdrawReasons ,
177
+ Get , Imbalance , LockIdentifier , LockableCurrency , NamedReservableCurrency , OnUnbalanced ,
178
+ ReservableCurrency , SignedImbalance , StoredMap , TryDrop , WithdrawReasons ,
181
179
} ,
182
180
WeakBoundedVec ,
183
181
} ;
@@ -664,7 +662,7 @@ impl BitOr for Reasons {
664
662
#[ derive( Encode , Decode , Clone , PartialEq , Eq , RuntimeDebug , MaxEncodedLen , TypeInfo ) ]
665
663
pub struct BalanceLock < Balance > {
666
664
/// An identifier for this lock. Only one lock may be in existence for each identifier.
667
- pub id : fungibles :: LockIdentifier ,
665
+ pub id : LockIdentifier ,
668
666
/// The amount which the free balance may not drop below when this lock is in effect.
669
667
pub amount : Balance ,
670
668
/// If true, then the lock remains in effect even for payment of transaction fees.
@@ -2133,7 +2131,7 @@ where
2133
2131
}
2134
2132
}
2135
2133
2136
- impl < T : Config < I > , I : ' static > fungibles :: Lockable < T :: AccountId > for Pallet < T , I >
2134
+ impl < T : Config < I > , I : ' static > LockableCurrency < T :: AccountId > for Pallet < T , I >
2137
2135
where
2138
2136
T :: Balance : MaybeSerializeDeserialize + Debug ,
2139
2137
{
@@ -2144,7 +2142,7 @@ where
2144
2142
// Set a lock on the balance of `who`.
2145
2143
// Is a no-op if lock amount is zero or `reasons` `is_none()`.
2146
2144
fn set_lock (
2147
- id : fungibles :: LockIdentifier ,
2145
+ id : LockIdentifier ,
2148
2146
who : & T :: AccountId ,
2149
2147
amount : T :: Balance ,
2150
2148
reasons : WithdrawReasons ,
@@ -2166,7 +2164,7 @@ where
2166
2164
// Extend a lock on the balance of `who`.
2167
2165
// Is a no-op if lock amount is zero or `reasons` `is_none()`.
2168
2166
fn extend_lock (
2169
- id : fungibles :: LockIdentifier ,
2167
+ id : LockIdentifier ,
2170
2168
who : & T :: AccountId ,
2171
2169
amount : T :: Balance ,
2172
2170
reasons : WithdrawReasons ,
@@ -2195,7 +2193,7 @@ where
2195
2193
Self :: update_locks ( who, & locks[ ..] ) ;
2196
2194
}
2197
2195
2198
- fn remove_lock ( id : fungibles :: LockIdentifier , who : & T :: AccountId ) {
2196
+ fn remove_lock ( id : LockIdentifier , who : & T :: AccountId ) {
2199
2197
let mut locks = Self :: locks ( who) ;
2200
2198
locks. retain ( |l| l. id != id) ;
2201
2199
Self :: update_locks ( who, & locks[ ..] ) ;
0 commit comments