Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
use the correct bridge config
Browse files Browse the repository at this point in the history
  • Loading branch information
alistair-singh committed Nov 3, 2023
1 parent dba7cff commit 0ee181e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ use xcm::latest::prelude::*;
use xcm_executor::XcmExecutor;

use crate::xcm_config::{
bridging::to_rococo::EthereumLocation, ForeignCreatorsSovereignAccountOf,
bridging::to_wococo::EthereumLocation, ForeignCreatorsSovereignAccountOf,
LocalAndForeignAssetsMultiLocationMatcher, TrustBackedAssetsPalletLocation,
};
use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use super::{
};
use assets_common::{
local_and_foreign_assets::MatchesLocalAndForeignAssetsMultiLocation,
matching::{FromSiblingParachain, IsForeignConcreteAsset},
matching::{FromNetwork, FromSiblingParachain, IsForeignConcreteAsset},
};
use frame_support::{
match_types, parameter_types,
Expand Down Expand Up @@ -563,8 +563,8 @@ impl xcm_executor::Config for XcmConfig {
// Users must use teleport where allowed (e.g. ROC with the Relay Chain).
type IsReserve = (
bridging::to_wococo::IsTrustedBridgedReserveLocationForConcreteAsset,
bridging::to_wococo::IsTrustedBridgedReserveLocationForForeignAsset,
bridging::to_rococo::IsTrustedBridgedReserveLocationForConcreteAsset,
bridging::to_rococo::IsTrustedBridgedReserveLocationForForeignAsset,
);
type IsTeleporter = TrustedTeleporters;
type UniversalLocation = UniversalLocation;
Expand Down Expand Up @@ -782,6 +782,8 @@ pub mod bridging {
pub const WococoNetwork: NetworkId = NetworkId::Wococo;
pub AssetHubWococo: MultiLocation = MultiLocation::new(2, X2(GlobalConsensus(WococoNetwork::get()), Parachain(bp_asset_hub_wococo::ASSET_HUB_WOCOCO_PARACHAIN_ID)));
pub WocLocation: MultiLocation = MultiLocation::new(2, X1(GlobalConsensus(WococoNetwork::get())));
pub EthereumNetwork: NetworkId = NetworkId::Ethereum { chain_id: 15 };
pub EthereumLocation: MultiLocation = MultiLocation::new(2, X1(GlobalConsensus(EthereumNetwork::get())));

pub WocFromAssetHubWococo: (MultiAssetFilter, MultiLocation) = (
Wild(AllOf { fun: WildFungible, id: Concrete(WocLocation::get()) }),
Expand All @@ -802,7 +804,18 @@ pub mod bridging {
XcmBridgeHubRouterFeeAssetId::get(),
bp_asset_hub_rococo::BridgeHubRococoBaseFeeInRocs::get(),
).into())
)
),
NetworkExportTableItem::new(
EthereumNetwork::get(),
Some(sp_std::vec![
EthereumLocation::get().interior.split_global().expect("invalid configuration for Ethereum").1,
]),
SiblingBridgeHub::get(),
Some((
XcmBridgeHubRouterFeeAssetId::get(),
BridgeHubEthereumBaseFeeInRocs::get(),
).into())
),
];

/// Allowed assets for reserve transfer to `AssetHubWococo`.
Expand All @@ -815,11 +828,15 @@ pub mod bridging {
/// Universal aliases
pub UniversalAliases: BTreeSet<(MultiLocation, Junction)> = BTreeSet::from_iter(
sp_std::vec![
(SiblingBridgeHubWithBridgeHubWococoInstance::get(), GlobalConsensus(WococoNetwork::get()))
(SiblingBridgeHubWithBridgeHubWococoInstance::get(), GlobalConsensus(WococoNetwork::get())),
(SiblingBridgeHub::get(), GlobalConsensus(EthereumNetwork::get())),
]
);
}

pub type IsTrustedBridgedReserveLocationForForeignAsset =
matching::IsForeignConcreteAsset<FromNetwork<EthereumNetwork>>;

impl Contains<(MultiLocation, Junction)> for UniversalAliases {
fn contains(alias: &(MultiLocation, Junction)) -> bool {
UniversalAliases::get().contains(alias)
Expand Down Expand Up @@ -858,7 +875,6 @@ pub mod bridging {

pub mod to_rococo {
use super::*;
use assets_common::matching::FromNetwork;

parameter_types! {
pub SiblingBridgeHubWithBridgeHubRococoInstance: MultiLocation = MultiLocation::new(
Expand All @@ -872,8 +888,6 @@ pub mod bridging {
pub const RococoNetwork: NetworkId = NetworkId::Rococo;
pub AssetHubRococo: MultiLocation = MultiLocation::new(2, X2(GlobalConsensus(RococoNetwork::get()), Parachain(bp_asset_hub_rococo::ASSET_HUB_ROCOCO_PARACHAIN_ID)));
pub RocLocation: MultiLocation = MultiLocation::new(2, X1(GlobalConsensus(RococoNetwork::get())));
pub EthereumNetwork: NetworkId = NetworkId::Ethereum { chain_id: 15 };
pub EthereumLocation: MultiLocation = MultiLocation::new(2, X1(GlobalConsensus(EthereumNetwork::get())));

pub RocFromAssetHubRococo: (MultiAssetFilter, MultiLocation) = (
Wild(AllOf { fun: WildFungible, id: Concrete(RocLocation::get()) }),
Expand All @@ -895,17 +909,6 @@ pub mod bridging {
bp_asset_hub_wococo::BridgeHubWococoBaseFeeInWocs::get(),
).into())
),
NetworkExportTableItem::new(
EthereumNetwork::get(),
Some(sp_std::vec![
EthereumLocation::get().interior,
]),
SiblingBridgeHub::get(),
Some((
XcmBridgeHubRouterFeeAssetId::get(),
BridgeHubEthereumBaseFeeInRocs::get(),
).into())
),
];

/// Allowed assets for reserve transfer to `AssetHubWococo`.
Expand All @@ -919,7 +922,6 @@ pub mod bridging {
pub UniversalAliases: BTreeSet<(MultiLocation, Junction)> = BTreeSet::from_iter(
sp_std::vec![
(SiblingBridgeHubWithBridgeHubRococoInstance::get(), GlobalConsensus(RococoNetwork::get())),
(SiblingBridgeHub::get(), GlobalConsensus(EthereumNetwork::get())),
]
);
}
Expand All @@ -942,9 +944,6 @@ pub mod bridging {
),
>;

pub type IsTrustedBridgedReserveLocationForForeignAsset =
matching::IsForeignConcreteAsset<FromNetwork<EthereumNetwork>>;

/// Allows to reserve transfer assets to `AssetHubRococo`.
pub type AllowedReserveTransferAssets = LocationWithAssetFilters<
Equals<AssetHubRococo>,
Expand Down

0 comments on commit 0ee181e

Please sign in to comment.