staging_xcm_executor/traits/record_xcm.rs
1// Copyright (C) Parity Technologies (UK) Ltd.
2// This file is part of Polkadot.
3
4// Polkadot 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// Polkadot 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 Polkadot. If not, see <http://www.gnu.org/licenses/>.
16
17//! Trait for recording XCMs and a dummy implementation.
18
19use xcm::latest::Xcm;
20
21/// Trait for recording XCMs.
22pub trait RecordXcm {
23 /// Whether or not we should record incoming XCMs.
24 fn should_record() -> bool;
25 /// Enable or disable recording.
26 fn set_record_xcm(enabled: bool);
27 /// Get recorded XCM.
28 /// Returns `None` if no message was sent, or if recording was off.
29 fn recorded_xcm() -> Option<Xcm<()>>;
30 /// Record `xcm`.
31 fn record(xcm: Xcm<()>);
32}
33
34impl RecordXcm for () {
35 fn should_record() -> bool {
36 false
37 }
38
39 fn set_record_xcm(_: bool) {}
40
41 fn recorded_xcm() -> Option<Xcm<()>> {
42 None
43 }
44
45 fn record(_: Xcm<()>) {}
46}