difftreelog
feat switch `configuration` from `Currency` trait to `fungible::*` traits
in: master
2 files changed
pallets/configuration/src/benchmarking.rsdiffbeforeafterboth19use super::*;19use super::*;20use frame_benchmarking::benchmarks;20use frame_benchmarking::benchmarks;21use frame_system::{EventRecord, RawOrigin};21use frame_system::{EventRecord, RawOrigin};22use frame_support::{assert_ok, traits::Currency};22use frame_support::{assert_ok, traits::fungible::Inspect};232324fn assert_last_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) {24fn assert_last_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) {25 let events = frame_system::Pallet::<T>::events();25 let events = frame_system::Pallet::<T>::events();68 }68 }696970 set_collator_selection_license_bond {70 set_collator_selection_license_bond {71 let bond_cost: Option<BalanceOf<T>> = Some(T::Currency::minimum_balance() * 10u32.into());71 let bond_cost: Option<BalanceOf<T>> = Some(T::Balances::minimum_balance() * 10u32.into());72 }: {72 }: {73 assert_ok!(73 assert_ok!(74 <Pallet<T>>::set_collator_selection_license_bond(RawOrigin::Root.into(), bond_cost.clone())74 <Pallet<T>>::set_collator_selection_license_bond(RawOrigin::Root.into(), bond_cost.clone())pallets/configuration/src/lib.rsdiffbeforeafterboth--- a/pallets/configuration/src/lib.rs
+++ b/pallets/configuration/src/lib.rs
@@ -42,23 +42,28 @@
mod pallet {
use super::*;
use frame_support::{
- traits::{Get, ReservableCurrency, Currency},
+ traits::{fungible, Get, ReservableCurrency, Currency},
pallet_prelude::{StorageValue, ValueQuery, DispatchResult, IsType},
log,
};
use frame_system::{pallet_prelude::OriginFor, ensure_root, Config as SystemConfig};
pub use crate::weights::WeightInfo;
- pub type BalanceOf<T> =
- <<T as Config>::Currency as Currency<<T as SystemConfig>::AccountId>>::Balance;
+ pub type BalanceOf<T> =
+ <<T as Config>::Balances as fungible::Inspect<<T as SystemConfig>::AccountId>>::Balance;
#[pallet::config]
pub trait Config: frame_system::Config {
/// Overarching event type.
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
- /// The currency mechanism.
- type Currency: ReservableCurrency<Self::AccountId>;
+ type Balances:
+ fungible::Inspect<Self::AccountId>
+ + fungible::Mutate::<Self::AccountId>
+ + fungible::MutateFreeze::<Self::AccountId>
+ + fungible::InspectHold::<Self::AccountId>
+ + fungible::MutateHold::<Self::AccountId>
+ + fungible::BalancedHold::<Self::AccountId>;
#[pallet::constant]
type DefaultWeightToFeeCoefficient: Get<u64>;