snowbridge_inbound_queue_primitives/v2/traits.rs
1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: 2025 Snowfork <hello@snowfork.com>
3// SPDX-FileCopyrightText: 2021-2025 Parity Technologies (UK) Ltd.
4use super::Message;
5use sp_core::RuntimeDebug;
6use xcm::latest::Xcm;
7
8/// Converts an inbound message from Ethereum to an XCM message that can be
9/// executed on a parachain.
10pub trait ConvertMessage {
11 fn convert(message: Message) -> Result<Xcm<()>, ConvertMessageError>;
12}
13
14/// Reason why a message conversion failed.
15#[derive(Copy, Clone, RuntimeDebug, PartialEq)]
16pub enum ConvertMessageError {
17 /// Invalid foreign ERC-20 token ID
18 InvalidAsset,
19 /// Cannot reachor a foreign ERC-20 asset location.
20 CannotReanchor,
21 /// Invalid network specified (not from Ethereum)
22 InvalidNetwork,
23}