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.rsdiffbeforeafterboth42mod pallet {42mod pallet {43 use super::*;43 use super::*;44 use frame_support::{44 use frame_support::{45 traits::{Get, ReservableCurrency, Currency},45 traits::{fungible, Get, ReservableCurrency, Currency},46 pallet_prelude::{StorageValue, ValueQuery, DispatchResult, IsType},46 pallet_prelude::{StorageValue, ValueQuery, DispatchResult, IsType},47 log,47 log,48 };48 };49 use frame_system::{pallet_prelude::OriginFor, ensure_root, Config as SystemConfig};49 use frame_system::{pallet_prelude::OriginFor, ensure_root, Config as SystemConfig};505051 pub use crate::weights::WeightInfo;51 pub use crate::weights::WeightInfo;52 pub type BalanceOf<T> =52 pub type BalanceOf<T> = 53 <<T as Config>::Currency as Currency<<T as SystemConfig>::AccountId>>::Balance;53 <<T as Config>::Balances as fungible::Inspect<<T as SystemConfig>::AccountId>>::Balance;545455 #[pallet::config]55 #[pallet::config]56 pub trait Config: frame_system::Config {56 pub trait Config: frame_system::Config {57 /// Overarching event type.57 /// Overarching event type.58 type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;58 type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;595960 /// The currency mechanism.61 type Currency: ReservableCurrency<Self::AccountId>;60 type Balances:61 fungible::Inspect<Self::AccountId>62 + fungible::Mutate::<Self::AccountId>63 + fungible::MutateFreeze::<Self::AccountId>64 + fungible::InspectHold::<Self::AccountId>65 + fungible::MutateHold::<Self::AccountId>66 + fungible::BalancedHold::<Self::AccountId>;626763 #[pallet::constant]68 #[pallet::constant]64 type DefaultWeightToFeeCoefficient: Get<u64>;69 type DefaultWeightToFeeCoefficient: Get<u64>;