Skip to content

Commit d21f713

Browse files
authored
add possibility to create your own minted asset diff to parent (#85)
1 parent 3a89c55 commit d21f713

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

pallets/foreign-asset-creator/src/benchmarks.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,29 +26,34 @@ use sp_arithmetic::traits::AtLeast16BitUnsigned;
2626
use staging_xcm::latest::prelude::*;
2727

2828
#[allow(dead_code)]
29-
pub fn create_default_minted_asset<T: Config>(
29+
pub fn create_minted_asset<T: Config>(
3030
amount: AssetBalance<T>,
3131
receiver: T::AccountId,
32+
asset_location: Option<Location>,
3233
) -> (AssetId<T>, T::ForeignAsset)
3334
where
3435
T::ForeignAsset: From<Location>,
3536
T::Fungibles: fungibles::Mutate<T::AccountId>,
3637
AssetId<T>: AtLeast16BitUnsigned,
3738
{
38-
let (asset_id, foreign_asset) = create_default_asset::<T>(true);
39+
let (asset_id, foreign_asset) = create_asset::<T>(true, asset_location);
3940

4041
assert!(T::Fungibles::mint_into(asset_id.clone(), &receiver, amount).is_ok());
4142
(asset_id, foreign_asset)
4243
}
4344

4445
#[allow(dead_code)]
45-
fn create_default_asset<T: Config>(is_sufficient: bool) -> (AssetId<T>, T::ForeignAsset)
46+
fn create_asset<T: Config>(
47+
is_sufficient: bool,
48+
asset_location: Option<Location>,
49+
) -> (AssetId<T>, T::ForeignAsset)
4650
where
4751
T::ForeignAsset: From<Location>,
4852
AssetId<T>: AtLeast16BitUnsigned,
4953
{
5054
let asset_id: AssetId<T> = 1u16.into();
51-
let foreign_asset: T::ForeignAsset = Location::parent().into();
55+
let asset_location = asset_location.unwrap_or(Location::parent());
56+
let foreign_asset: T::ForeignAsset = asset_location.into();
5257
let admin: T::AccountId = whitelisted_caller();
5358
let origin = T::ForeignAssetCreatorOrigin::try_successful_origin()
5459
.map_err(|_| BenchmarkError::Weightless)

0 commit comments

Comments
 (0)