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
@@ -101,8 +101,8 @@
use codec::{Decode, Encode};
use frame_support::{
traits::{
defensive_prelude::*, ChangeMembers, Contains, ContainsLengthBound, Currency,
CurrencyToVote, Get, InitializeMembers, LockIdentifier, LockableCurrency, OnUnbalanced,
defensive_prelude::*, fungibles, fungibles::Lockable, ChangeMembers, Contains,
ContainsLengthBound, Currency, CurrencyToVote, Get, InitializeMembers, OnUnbalanced,
ReservableCurrency, SortedMembers, WithdrawReasons,
},
weights::Weight,
@@ -199,10 +199,10 @@ pub mod pallet {
/// Identifier for the elections-phragmen pallet's lock
#[pallet::constant]
type PalletId: Get<LockIdentifier>;
type PalletId: Get<fungibles::LockIdentifier>;
/// The currency that people are electing with.
type Currency: LockableCurrency<Self::AccountId, Moment = Self::BlockNumber>
type Currency: fungibles::Lockable<Self::AccountId, Moment = Self::BlockNumber>
+ ReservableCurrency<Self::AccountId>;
/// What to do when the members change.
@@ -1274,7 +1274,7 @@ mod tests {
}
parameter_types! {
pub const ElectionsPhragmenPalletId: LockIdentifier = *b"phrelect";
pub const ElectionsPhragmenPalletId: fungibles::LockIdentifier = *b"phrelect";
pub const PhragmenMaxVoters: u32 = 1000;
pub const PhragmenMaxCandidates: u32 = 100;
}