mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-20 17:31:02 +00:00
Use set_balance() instead of write_balance() in benchmark (#14497)
* Use set_balance instead of write_balance in benchmark * Another approach * Use BalanceOf::<T>::max_value() / 1000 * use a regular div instead of a checked one
This commit is contained in:
@@ -23,13 +23,13 @@ use frame_support::{
|
|||||||
assert_ok,
|
assert_ok,
|
||||||
storage::bounded_vec::BoundedVec,
|
storage::bounded_vec::BoundedVec,
|
||||||
traits::{
|
traits::{
|
||||||
fungible::{Inspect as InspectFungible, Unbalanced},
|
fungible::{Inspect as InspectFungible, Mutate as MutateFungible, Unbalanced},
|
||||||
fungibles::{Create, Inspect, Mutate},
|
fungibles::{Create, Inspect, Mutate},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use frame_system::RawOrigin as SystemOrigin;
|
use frame_system::RawOrigin as SystemOrigin;
|
||||||
use sp_runtime::traits::{Bounded, StaticLookup};
|
use sp_runtime::traits::{Bounded, StaticLookup};
|
||||||
use sp_std::prelude::*;
|
use sp_std::{ops::Div, prelude::*};
|
||||||
|
|
||||||
use crate::Pallet as AssetConversion;
|
use crate::Pallet as AssetConversion;
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ where
|
|||||||
let caller: T::AccountId = whitelisted_caller();
|
let caller: T::AccountId = whitelisted_caller();
|
||||||
let caller_lookup = T::Lookup::unlookup(caller.clone());
|
let caller_lookup = T::Lookup::unlookup(caller.clone());
|
||||||
if let Ok(asset_id) = T::MultiAssetIdConverter::try_convert(asset) {
|
if let Ok(asset_id) = T::MultiAssetIdConverter::try_convert(asset) {
|
||||||
assert_ok!(T::Currency::write_balance(&caller, BalanceOf::<T>::max_value()));
|
T::Currency::set_balance(&caller, BalanceOf::<T>::max_value().div(1000u32.into()));
|
||||||
assert_ok!(T::Assets::create(asset_id.clone(), caller.clone(), true, 1.into()));
|
assert_ok!(T::Assets::create(asset_id.clone(), caller.clone(), true, 1.into()));
|
||||||
assert_ok!(T::Assets::mint_into(asset_id, &caller, INITIAL_ASSET_BALANCE.into()));
|
assert_ok!(T::Assets::mint_into(asset_id, &caller, INITIAL_ASSET_BALANCE.into()));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user