diff --git a/pallets/distance/src/benchmarking.rs b/pallets/distance/src/benchmarking.rs index bd44e676948414b4c674baa3e09b2bd87b33b196..8b3c3e00b509470c67bbc9e8c3a1a09a1ba28ecb 100644 --- a/pallets/distance/src/benchmarking.rs +++ b/pallets/distance/src/benchmarking.rs @@ -21,7 +21,7 @@ use super::*; use codec::Encode; use frame_benchmarking::v2::*; -use frame_support::traits::{Get, OnFinalize, OnInitialize}; +use frame_support::traits::{fungible::Mutate, Get, OnFinalize, OnInitialize}; use frame_system::{pallet_prelude::BlockNumberFor, RawOrigin}; use scale_info::prelude::vec; use sp_runtime::Perbill; diff --git a/pallets/distance/src/tests.rs b/pallets/distance/src/tests.rs index 4ec3087cbc36f1f10c13e24bfdacbfc40a08c835..ab6c19eaf3033bee047d55bbb53b1a82d144965c 100644 --- a/pallets/distance/src/tests.rs +++ b/pallets/distance/src/tests.rs @@ -15,7 +15,7 @@ // along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>. use crate::{mock::*, *}; -use frame_support::{assert_noop, assert_ok, traits::Currency}; +use frame_support::{assert_noop, assert_ok, traits::fungible::Mutate}; // allow request distance evaluation for oneself #[test] @@ -23,7 +23,7 @@ fn test_request_distance_evaluation() { new_test_ext().execute_with(|| { run_to_block(1); // give enough for reserve - Balances::make_free_balance_be(&1, 10_000); + Balances::set_balance(&1, 10_000); // call request assert_ok!(Distance::request_distance_evaluation( @@ -45,7 +45,7 @@ fn test_request_distance_evaluation_for() { new_test_ext().execute_with(|| { run_to_block(1); // give enough for reserve - Balances::make_free_balance_be(&1, 10_000); + Balances::set_balance(&1, 10_000); assert_ok!(Identity::create_identity(RuntimeOrigin::signed(1), 5)); assert_ok!(Identity::confirm_identity( RuntimeOrigin::signed(5), @@ -73,7 +73,7 @@ fn test_request_distance_evaluation_non_member() { new_test_ext().execute_with(|| { run_to_block(1); // give enough for reserve - Balances::make_free_balance_be(&5, 10_000); + Balances::set_balance(&5, 10_000); assert_noop!( Distance::request_distance_evaluation_for(RuntimeOrigin::signed(5), 1), @@ -93,7 +93,7 @@ fn test_request_distance_evaluation_twice() { new_test_ext().execute_with(|| { run_to_block(1); // give enough for reserve - Balances::make_free_balance_be(&1, 10_000); + Balances::set_balance(&1, 10_000); assert_ok!(Distance::request_distance_evaluation( RuntimeOrigin::signed(1) diff --git a/pallets/quota/src/benchmarking.rs b/pallets/quota/src/benchmarking.rs index 24dcd895e3065766c64472b68d960538e3c44dfe..b34678f80d2b8762fcb7c3a3ba71313413b971de 100644 --- a/pallets/quota/src/benchmarking.rs +++ b/pallets/quota/src/benchmarking.rs @@ -18,6 +18,7 @@ use super::*; use frame_benchmarking::{account, v2::*}; +use frame_support::traits::fungible::Mutate; use sp_runtime::traits::One; fn assert_has_event<T: Config>(generic_event: <T as Config>::RuntimeEvent) { @@ -98,7 +99,7 @@ mod benchmarks { amount: 10u64.into(), }, ); - let _ = CurrencyOf::<T>::make_free_balance_be(&T::RefundAccount::get(), u32::MAX.into()); + let _ = CurrencyOf::<T>::set_balance(&T::RefundAccount::get(), u32::MAX.into()); // The worst-case scenario is when the refund fails // and can only be triggered if the account is dead, // in this case by having no balance in the account. @@ -119,7 +120,7 @@ mod benchmarks { #[benchmark] fn do_refund() { let account: T::AccountId = account("Alice", 1, 1); - let _ = CurrencyOf::<T>::make_free_balance_be(&T::RefundAccount::get(), u32::MAX.into()); + let _ = CurrencyOf::<T>::set_balance(&T::RefundAccount::get(), u32::MAX.into()); // The worst-case scenario is when the refund fails // and can only be triggered if the account is dead, // in this case by having no balance in the account. @@ -161,7 +162,7 @@ mod benchmarks { amount: 10u64.into(), }, ); - let _ = CurrencyOf::<T>::make_free_balance_be(&T::RefundAccount::get(), u32::MAX.into()); + let _ = CurrencyOf::<T>::set_balance(&T::RefundAccount::get(), u32::MAX.into()); // The worst-case scenario is when the refund fails // and can only be triggered if the account is dead, // in this case by having no balance in the account. diff --git a/pallets/quota/src/tests.rs b/pallets/quota/src/tests.rs index 40f7469286abeda7cad25e159294f1b132f18f84..e5e080e4355a1c90051efe440e2700e8f969f0f4 100644 --- a/pallets/quota/src/tests.rs +++ b/pallets/quota/src/tests.rs @@ -15,7 +15,7 @@ // along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>. use crate::{mock::*, Weight}; -use frame_support::traits::Currency; +use frame_support::traits::fungible::Mutate; use sp_core::Get; // Note: values for reload rate and max quota defined in mock file @@ -150,10 +150,10 @@ fn test_process_refund_queue() { .execute_with(|| { run_to_block(5); // give enough currency to accounts and treasury and double check - Balances::make_free_balance_be(&account(1), 1000); - Balances::make_free_balance_be(&account(2), 1000); - Balances::make_free_balance_be(&account(3), 1000); - Balances::make_free_balance_be( + Balances::set_balance(&account(1), 1000); + Balances::set_balance(&account(2), 1000); + Balances::set_balance(&account(3), 1000); + Balances::set_balance( &<Test as pallet_quota::Config>::RefundAccount::get(), 10_000, ); @@ -208,8 +208,8 @@ fn test_not_enough_treasury() { }) .execute_with(|| { run_to_block(5); - Balances::make_free_balance_be(&account(1), 1000); - Balances::make_free_balance_be(&<Test as pallet_quota::Config>::RefundAccount::get(), 1200); + Balances::set_balance(&account(1), 1000); + Balances::set_balance(&<Test as pallet_quota::Config>::RefundAccount::get(), 1200); Quota::queue_refund(pallet_quota::Refund { account: account(1), identity: 1, @@ -246,10 +246,10 @@ fn test_process_refund_queue_weight_with_quotas() { .execute_with(|| { run_to_block(15); // give enough currency to accounts and treasury and double check - Balances::make_free_balance_be(&account(1), 1000); - Balances::make_free_balance_be(&account(2), 1000); - Balances::make_free_balance_be(&account(3), 1000); - Balances::make_free_balance_be( + Balances::set_balance(&account(1), 1000); + Balances::set_balance(&account(2), 1000); + Balances::set_balance(&account(3), 1000); + Balances::set_balance( &<Test as pallet_quota::Config>::RefundAccount::get(), 10_000, ); @@ -314,10 +314,10 @@ fn test_process_refund_queue_weight_no_quotas() { .execute_with(|| { run_to_block(15); // give enough currency to accounts and treasury and double check - Balances::make_free_balance_be(&account(1), 1000); - Balances::make_free_balance_be(&account(2), 1000); - Balances::make_free_balance_be(&account(3), 1000); - Balances::make_free_balance_be( + Balances::set_balance(&account(1), 1000); + Balances::set_balance(&account(2), 1000); + Balances::set_balance(&account(3), 1000); + Balances::set_balance( &<Test as pallet_quota::Config>::RefundAccount::get(), 10_000, );