git.delta.rocks / unique-network / refs/commits / dbb52bba3658

difftreelog

fix use feature gate for foreign-assets gov

Daniel Shiposha2023-10-18parent: #9c50a8c.patch.diff
in: master

1 file changed

modifiedruntime/common/config/pallets/foreign_asset.rsdiffbeforeafterboth
after · runtime/common/config/pallets/foreign_asset.rs
1use frame_support::{parameter_types, PalletId};2use pallet_evm::account::CrossAccountId;3use sp_core::H160;4use staging_xcm::prelude::*;5use staging_xcm_builder::AccountKey20Aliases;67#[cfg(feature = "governance")]8use crate::runtime_common::config::governance;910#[cfg(not(feature = "governance"))]11use frame_system::EnsureRoot;1213use crate::{14	runtime_common::config::{15		ethereum::CrossAccountId as ConfigCrossAccountId,16		xcm::{LocationToAccountId, SelfLocation},17	},18	RelayNetwork, Runtime, RuntimeEvent,19};2021parameter_types! {22	pub ForeignAssetPalletId: PalletId = PalletId(*b"frgnasts");23}2425pub struct LocationToCrossAccountId;26impl staging_xcm_executor::traits::ConvertLocation<ConfigCrossAccountId>27	for LocationToCrossAccountId28{29	fn convert_location(location: &MultiLocation) -> Option<ConfigCrossAccountId> {30		LocationToAccountId::convert_location(location)31			.map(|sub| ConfigCrossAccountId::from_sub(sub))32			.or_else(|| {33				let eth_address =34					AccountKey20Aliases::<RelayNetwork, H160>::convert_location(location)?;3536				Some(ConfigCrossAccountId::from_eth(eth_address))37			})38	}39}4041impl pallet_foreign_assets::Config for Runtime {42	type RuntimeEvent = RuntimeEvent;4344	#[cfg(feature = "governance")]45	type ForceRegisterOrigin = governance::RootOrTechnicalCommitteeMember;4647	#[cfg(not(feature = "governance"))]48	type ForceRegisterOrigin = EnsureRoot<Self::AccountId>;4950	type PalletId = ForeignAssetPalletId;51	type SelfLocation = SelfLocation;52	type LocationToAccountId = LocationToCrossAccountId;53	type WeightInfo = pallet_foreign_assets::weights::SubstrateWeight<Self>;54}