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