From fcb9d1c78d90c8b815e019d68cd3627a739ed86b Mon Sep 17 00:00:00 2001 From: Grigoriy Simonov Date: Mon, 22 May 2023 13:21:36 +0000 Subject: [PATCH] feat: switch `configuration` from `Currency` trait to `fungible::*` traits --- --- a/pallets/configuration/src/benchmarking.rs +++ b/pallets/configuration/src/benchmarking.rs @@ -19,7 +19,7 @@ use super::*; use frame_benchmarking::benchmarks; use frame_system::{EventRecord, RawOrigin}; -use frame_support::{assert_ok, traits::Currency}; +use frame_support::{assert_ok, traits::fungible::Inspect}; fn assert_last_event(generic_event: ::RuntimeEvent) { let events = frame_system::Pallet::::events(); @@ -68,7 +68,7 @@ } set_collator_selection_license_bond { - let bond_cost: Option> = Some(T::Currency::minimum_balance() * 10u32.into()); + let bond_cost: Option> = Some(T::Balances::minimum_balance() * 10u32.into()); }: { assert_ok!( >::set_collator_selection_license_bond(RawOrigin::Root.into(), bond_cost.clone()) --- 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 = - <::Currency as Currency<::AccountId>>::Balance; + pub type BalanceOf = + <::Balances as fungible::Inspect<::AccountId>>::Balance; #[pallet::config] pub trait Config: frame_system::Config { /// Overarching event type. type RuntimeEvent: From> + IsType<::RuntimeEvent>; - /// The currency mechanism. - type Currency: ReservableCurrency; + type Balances: + fungible::Inspect + + fungible::Mutate:: + + fungible::MutateFreeze:: + + fungible::InspectHold:: + + fungible::MutateHold:: + + fungible::BalancedHold::; #[pallet::constant] type DefaultWeightToFeeCoefficient: Get; -- gitstuff