@@ -1563,7 +1563,12 @@ impl_runtime_apis! {
1563
1563
fn dispatch_benchmark(
1564
1564
config: frame_benchmarking:: BenchmarkConfig
1565
1565
) -> Result <Vec <frame_benchmarking:: BenchmarkBatch >, alloc:: string:: String > {
1566
+ <<<<<<< HEAD
1566
1567
use frame_benchmarking:: { Benchmarking , BenchmarkBatch , BenchmarkError } ;
1568
+ =======
1569
+ use frame_benchmarking:: { BenchmarkBatch , BenchmarkError } ;
1570
+ use frame_support:: assert_ok;
1571
+ >>>>>>> c4b8ec12 ( Use non-native token to benchmark xcm on asset hub ( #7893 ) )
1567
1572
use sp_storage:: TrackedStorageKey ;
1568
1573
1569
1574
use frame_system_benchmarking:: Pallet as SystemBench ;
@@ -1688,9 +1693,27 @@ impl_runtime_apis! {
1688
1693
}
1689
1694
1690
1695
fn get_asset( ) -> Asset {
1696
+ use frame_benchmarking:: whitelisted_caller;
1697
+ use frame_support:: traits:: tokens:: fungible:: { Inspect , Mutate } ;
1698
+ let account = whitelisted_caller( ) ;
1699
+ assert_ok!( <Balances as Mutate <_>>:: mint_into(
1700
+ & account,
1701
+ <Balances as Inspect <_>>:: minimum_balance( ) ,
1702
+ ) ) ;
1703
+ let asset_id = 1984 ;
1704
+ assert_ok!( Assets :: force_create(
1705
+ RuntimeOrigin :: root( ) ,
1706
+ asset_id. into( ) ,
1707
+ account. into( ) ,
1708
+ true ,
1709
+ 1u128 ,
1710
+ ) ) ;
1711
+ let amount = 1_000_000u128 ;
1712
+ let asset_location = Location :: new( 0 , [ PalletInstance ( 50 ) , GeneralIndex ( u32 :: from( asset_id) . into( ) ) ] ) ;
1713
+
1691
1714
Asset {
1692
- id: AssetId ( Location :: parent ( ) ) ,
1693
- fun: Fungible ( ExistentialDeposit :: get ( ) ) ,
1715
+ id: AssetId ( asset_location ) ,
1716
+ fun: Fungible ( amount ) ,
1694
1717
}
1695
1718
}
1696
1719
}
@@ -1784,9 +1807,26 @@ impl_runtime_apis! {
1784
1807
type TrustedReserve = TrustedReserve ;
1785
1808
1786
1809
fn get_asset( ) -> Asset {
1810
+ use frame_support:: traits:: tokens:: fungible:: { Inspect , Mutate } ;
1811
+ let ( account, _) = pallet_xcm_benchmarks:: account_and_location:: <Runtime >( 1 ) ;
1812
+ assert_ok!( <Balances as Mutate <_>>:: mint_into(
1813
+ & account,
1814
+ <Balances as Inspect <_>>:: minimum_balance( ) ,
1815
+ ) ) ;
1816
+ let asset_id = 1984 ;
1817
+ assert_ok!( Assets :: force_create(
1818
+ RuntimeOrigin :: root( ) ,
1819
+ asset_id. into( ) ,
1820
+ account. clone( ) . into( ) ,
1821
+ true ,
1822
+ 1u128 ,
1823
+ ) ) ;
1824
+ let amount = 1_000_000u128 ;
1825
+ let asset_location = Location :: new( 0 , [ PalletInstance ( 50 ) , GeneralIndex ( u32 :: from( asset_id) . into( ) ) ] ) ;
1826
+
1787
1827
Asset {
1788
- id: AssetId ( TokenLocation :: get ( ) ) ,
1789
- fun: Fungible ( UNITS ) ,
1828
+ id: AssetId ( asset_location ) ,
1829
+ fun: Fungible ( amount ) ,
1790
1830
}
1791
1831
}
1792
1832
}
0 commit comments