1
// Copyright Moonsong Labs
2
// This file is part of Moonkit.
3

            
4
// Moonkit 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
// Moonkit 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 Moonkit.  If not, see <http://www.gnu.org/licenses/>.
16

            
17
//! The XCM primitive trait implementations
18

            
19
#![cfg_attr(not(feature = "std"), no_std)]
20

            
21
use sp_runtime::DispatchResult;
22
use sp_std::vec::Vec;
23

            
24
pub mod generators;
25
pub mod location_matcher;
26

            
27
/// Pause and resume execution of XCM
28
pub trait PauseXcmExecution {
29
	fn suspend_xcm_execution() -> DispatchResult;
30
	fn resume_xcm_execution() -> DispatchResult;
31
}
32
impl PauseXcmExecution for () {
33
	fn suspend_xcm_execution() -> DispatchResult {
34
		Ok(())
35
	}
36
	fn resume_xcm_execution() -> DispatchResult {
37
		Ok(())
38
	}
39
}
40

            
41
/// This trait ensure we can convert AccountIds to AssetIds.
42
pub trait AccountIdAssetIdConversion<Account, AssetId> {
43
	// Get assetId and prefix from account
44
	fn account_to_asset_id(account: Account) -> Option<(Vec<u8>, AssetId)>;
45

            
46
	// Get AccountId from AssetId and prefix
47
	fn asset_id_to_account(prefix: &[u8], asset_id: AssetId) -> Account;
48
}