Skip to content

Commit

Permalink
Add governance + sibling parachain
Browse files Browse the repository at this point in the history
  • Loading branch information
TarekkMA committed Jan 29, 2025
1 parent 58a823d commit 3763644
Show file tree
Hide file tree
Showing 10 changed files with 508 additions and 423 deletions.
17 changes: 4 additions & 13 deletions pallets/moonbeam-foreign-assets/src/benchmarks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,18 @@

#![cfg(feature = "runtime-benchmarks")]

use crate::{pallet, AssetStatus, Call, Config, Pallet};
use frame_benchmarking::{account, benchmarks, impl_benchmark_test_suite};
use crate::{AssetStatus, Call, Config, Pallet};
use frame_benchmarking::{benchmarks, impl_benchmark_test_suite};
use frame_support::pallet_prelude::*;
use frame_support::traits::Currency;
use frame_system::RawOrigin;
use sp_runtime::traits::ConstU32;
use sp_runtime::BoundedVec;
use xcm::latest::prelude::*;

fn create_funded_user<T: Config>(string: &'static str, n: u32, balance: u32) -> T::AccountId {
const SEED: u32 = 0;
let user = account(string, n, SEED);
let _ = <T as pallet::Config>::Currency::make_free_balance_be(&user, balance.into());
let _ = <T as pallet::Config>::Currency::issue(balance.into());
user
}
fn create_n_foreign_asset<T: Config>(n: u32) -> DispatchResult {
let user: T::AccountId = create_funded_user::<T>("user", n, 100);
for i in 1..=n {
Pallet::<T>::create_foreign_asset(
RawOrigin::Signed(user.clone()).into(),
RawOrigin::Root.into(),
i as u128,
location_of(i),
18,
Expand All @@ -62,7 +53,7 @@ benchmarks! {
create_foreign_asset {
create_n_foreign_asset::<T>(T::MaxForeignAssets::get().saturating_sub(1))?;
let asset_id = T::MaxForeignAssets::get() as u128;
}: _(RawOrigin::Signed(create_funded_user::<T>("user", 1, 100)), asset_id, Location::parent(), 18, str_to_bv("MT"), str_to_bv("Mytoken"))
}: _(RawOrigin::Root, asset_id, Location::parent(), 18, str_to_bv("MT"), str_to_bv("Mytoken"))
verify {
assert_eq!(
Pallet::<T>::assets_by_id(asset_id),
Expand Down
Loading

0 comments on commit 3763644

Please sign in to comment.