1
// Copyright (C) Parity Technologies (UK) Ltd.
2
// This file is part of Parity Bridges Common.
3

            
4
// Parity Bridges Common is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8

            
9
// Parity Bridges Common is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13

            
14
// You should have received a copy of the GNU General Public License
15
// along with Parity Bridges Common.  If not, see <http://www.gnu.org/licenses/>.
16

            
17
//! Defines structures related to calls of the `pallet-xcm-bridge` pallet.
18

            
19
use crate::Receiver;
20
use bp_messages::MessageNonce;
21
use parity_scale_codec::{Decode, Encode};
22
use scale_info::TypeInfo;
23
use sp_std::boxed::Box;
24
use xcm::prelude::VersionedInteriorLocation;
25

            
26
/// A minimized version of `pallet_xcm_bridge::Call` that can be used without a runtime.
27
#[derive(Encode, Decode, Debug, PartialEq, Eq, Clone, TypeInfo)]
28
#[allow(non_camel_case_types)]
29
pub enum XcmBridgeCall {
30
	/// `pallet_xcm_bridge::Call::open_bridge`
31
	#[codec(index = 0)]
32
	open_bridge {
33
		/// Universal `InteriorLocation` from the bridged consensus.
34
		bridge_destination_universal_location: Box<VersionedInteriorLocation>,
35
		/// Optional `maybe_notify` holds data about the `bridge_origin_relative_location` where
36
		/// notifications can be sent to handle congestion.
37
		maybe_notify: Option<Receiver>,
38
	},
39
	/// `pallet_xcm_bridge::Call::close_bridge`
40
	#[codec(index = 1)]
41
	close_bridge {
42
		/// Universal `InteriorLocation` from the bridged consensus.
43
		bridge_destination_universal_location: Box<VersionedInteriorLocation>,
44
		/// The number of messages that we may prune in a single call.
45
		may_prune_messages: MessageNonce,
46
	},
47
}