Move LockableCurrency trait to fungibles::Lockable and deprecate LockableCurrency (#12798)

* WIP move LockableCurrency to fungibles

* rename Lockable and LockIdentifier to funginbles::*

* fix imports further

* change Lockable from fungible to fungibles

* reintroduce LockableCurrency but marked as deprecated

* fix imports

* fix imports

* cargo fmt

* add allow deprecated warnings

* remove unused benchmark import

* fix some of the docs

* fix failing doctest check

* reexport LockIdentifier and LockableCurrency from support/traits

* reexport LockIdentifier and LockableCurrency from support/traits

* allow using deprecated re-export

* replace LockableCurrency and LockIdentifier with a module alias

* Update frame/support/src/traits/tokens/fungibles/lockable.rs

* Update frame/staking/src/pallet/mod.rs

Co-authored-by: Squirrel <gilescope@gmail.com>

* Update frame/support/src/traits.rs

Co-authored-by: Squirrel <gilescope@gmail.com>

* REVERT removing fungibles::Lockable import

Co-authored-by: parity-processbot <>
Co-authored-by: Squirrel <gilescope@gmail.com>
This commit is contained in:
Anthony Alaribe
2022-12-08 14:47:13 +02:00
committed by GitHub
parent 39cb3b06cd
commit 9a014d1ecd
20 changed files with 135 additions and 105 deletions
+6 -5
View File
@@ -62,7 +62,7 @@ use frame_support::{
ensure,
storage::bounded_vec::BoundedVec,
traits::{
Currency, ExistenceRequirement, Get, LockIdentifier, LockableCurrency, VestingSchedule,
fungibles, fungibles::Lockable, Currency, ExistenceRequirement, Get, VestingSchedule,
WithdrawReasons,
},
weights::Weight,
@@ -83,11 +83,12 @@ pub use weights::WeightInfo;
type BalanceOf<T> =
<<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance;
type MaxLocksOf<T> =
<<T as Config>::Currency as LockableCurrency<<T as frame_system::Config>::AccountId>>::MaxLocks;
type MaxLocksOf<T> = <<T as Config>::Currency as fungibles::Lockable<
<T as frame_system::Config>::AccountId,
>>::MaxLocks;
type AccountIdLookupOf<T> = <<T as frame_system::Config>::Lookup as StaticLookup>::Source;
const VESTING_ID: LockIdentifier = *b"vesting ";
const VESTING_ID: fungibles::LockIdentifier = *b"vesting ";
// A value placed in storage that represents the current version of the Vesting storage.
// This value is used by `on_runtime_upgrade` to determine whether we run storage migration logic.
@@ -159,7 +160,7 @@ pub mod pallet {
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
/// The currency trait.
type Currency: LockableCurrency<Self::AccountId>;
type Currency: fungibles::Lockable<Self::AccountId>;
/// Convert the block number into a balance.
type BlockNumberToBalance: Convert<Self::BlockNumber, BalanceOf<Self>>;