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
@@ -23,7 +23,7 @@ use assert_matches::assert_matches;
use frame_benchmarking::{account, benchmarks_instance_pallet, whitelist_account};
use frame_support::{
dispatch::RawOrigin,
traits::{fungible, Currency, Get},
traits::{Currency, Get},
};
use sp_runtime::traits::Bounded;
use sp_std::collections::btree_map::BTreeMap;
+3 -3
View File
@@ -31,7 +31,7 @@ use frame_support::{
dispatch::{DispatchError, DispatchResult},
ensure,
traits::{
fungible, Currency, Get, LockIdentifier, LockableCurrency, PollStatus, Polling,
fungible, fungibles, fungibles::Lockable, Currency, Get, PollStatus, Polling,
ReservableCurrency, WithdrawReasons,
},
};
@@ -60,7 +60,7 @@ mod tests;
#[cfg(feature = "runtime-benchmarks")]
pub mod benchmarking;
const CONVICTION_VOTING_ID: LockIdentifier = *b"pyconvot";
const CONVICTION_VOTING_ID: fungibles::LockIdentifier = *b"pyconvot";
type AccountIdLookupOf<T> = <<T as frame_system::Config>::Lookup as StaticLookup>::Source;
type BalanceOf<T, I = ()> =
@@ -104,7 +104,7 @@ pub mod pallet {
type WeightInfo: WeightInfo;
/// Currency type with which voting happens.
type Currency: ReservableCurrency<Self::AccountId>
+ LockableCurrency<Self::AccountId, Moment = Self::BlockNumber>
+ fungibles::Lockable<Self::AccountId, Moment = Self::BlockNumber>
+ fungible::Inspect<Self::AccountId>;
/// The implementation of the logic which conducts polls.