referrerpolicy=no-referrer-when-downgrade

snowbridge_outbound_queue_primitives/
lib.rs

1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: 2023 Snowfork <hello@snowfork.com>
3#![cfg_attr(not(feature = "std"), no_std)]
4//! # Outbound
5//!
6//! Common traits and types
7pub mod v1;
8pub mod v2;
9
10use codec::{Decode, DecodeWithMemTracking, Encode};
11use frame_support::PalletError;
12use scale_info::TypeInfo;
13use sp_arithmetic::traits::{BaseArithmetic, Unsigned};
14use sp_core::RuntimeDebug;
15
16pub use snowbridge_verification_primitives::*;
17
18/// The operating mode of Channels and Gateway contract on Ethereum.
19#[derive(
20	Copy, Clone, Encode, Decode, DecodeWithMemTracking, PartialEq, Eq, RuntimeDebug, TypeInfo,
21)]
22pub enum OperatingMode {
23	/// Normal operations. Allow sending and receiving messages.
24	Normal,
25	/// Reject outbound messages. This allows receiving governance messages but does now allow
26	/// enqueuing of new messages from the Ethereum side. This can be used to close off a
27	/// deprecated channel or pause the bridge for upgrade operations.
28	RejectingOutboundMessages,
29}
30
31/// A trait for getting the local costs associated with sending a message.
32pub trait SendMessageFeeProvider {
33	type Balance: BaseArithmetic + Unsigned + Copy;
34
35	/// The local component of the message processing fees in native currency
36	fn local_fee() -> Self::Balance;
37}
38
39/// Reasons why sending to Ethereum could not be initiated
40#[derive(
41	Copy,
42	Clone,
43	Encode,
44	Decode,
45	DecodeWithMemTracking,
46	PartialEq,
47	Eq,
48	RuntimeDebug,
49	PalletError,
50	TypeInfo,
51)]
52pub enum SendError {
53	/// Message is too large to be safely executed on Ethereum
54	MessageTooLarge,
55	/// The bridge has been halted for maintenance
56	Halted,
57	/// Invalid Channel
58	InvalidChannel,
59	/// Invalid Origin
60	InvalidOrigin,
61}