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

Lock down token transfer to AssetHub only #62

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,29 @@ use crate::{
xcm_config::{AgentIdOf, UniversalLocation},
Runtime,
};
use cumulus_primitives_core::{InteriorMultiLocation, Parachain, X1};
use frame_support::traits::{ContainsPair, EverythingBut};
use rococo_runtime_constants::system_parachain::ASSET_HUB_ID;
use snowbridge_core::outbound::{AgentExecuteCommand, Command, Message};
use snowbridge_rococo_common::EthereumNetwork;
use snowbridge_router_primitives::outbound::EthereumBlobExporter;

pub struct NonAssetHubTokenTransfers;
impl ContainsPair<InteriorMultiLocation, Message> for NonAssetHubTokenTransfers {
fn contains(origin: &InteriorMultiLocation, message: &Message) -> bool {
matches!(
message.command,
Command::AgentExecute { command: AgentExecuteCommand::TransferToken { .. }, .. }
) && origin != &X1(Parachain(ASSET_HUB_ID))
}
}

type SnowbridgeExportFilter = EverythingBut<NonAssetHubTokenTransfers>;

pub type SnowbridgeExporter = EthereumBlobExporter<
UniversalLocation,
EthereumNetwork,
snowbridge_outbound_queue::Pallet<Runtime>,
AgentIdOf,
SnowbridgeExportFilter,
>;
Loading