Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Copyright 2021 Parity Technologies (UK) Ltd.
// This file is part of Polkadot.
// Polkadot is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Polkadot is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
use crate::*;
use frame_support::{parameter_types, weights::Weight};
use xcm_executor::traits::FilterAssetLocation;
// An xcm sender/receiver akin to > /dev/null
pub struct DevNull;
impl xcm::opaque::latest::SendXcm for DevNull {
fn send_xcm(_: MultiLocation, _: Xcm<()>) -> SendResult {
Ok(())
}
}
impl xcm_executor::traits::OnResponse for DevNull {
fn expecting_response(_: &MultiLocation, _: u64) -> bool {
false
}
fn on_response(_: &MultiLocation, _: u64, _: Response, _: Weight) -> Weight {
0
}
}
pub struct AccountIdConverter;
impl xcm_executor::traits::Convert<MultiLocation, u64> for AccountIdConverter {
fn convert(ml: MultiLocation) -> Result<u64, MultiLocation> {
match ml {
MultiLocation { parents: 0, interior: X1(Junction::AccountId32 { id, .. }) } =>
Ok(<u64 as codec::Decode>::decode(&mut &*id.to_vec()).unwrap()),
_ => Err(ml),
}
}
fn reverse(acc: u64) -> Result<MultiLocation, u64> {
Err(acc)
}
}
parameter_types! {
pub Ancestry: MultiLocation = Junction::Parachain(101).into();
pub UnitWeightCost: Weight = 10;
pub WeightPrice: (AssetId, u128) = (Concrete(Here.into()), 1_000_000);
}
pub struct AllAssetLocationsPass;
impl FilterAssetLocation for AllAssetLocationsPass {
fn filter_asset_location(_: &MultiAsset, _: &MultiLocation) -> bool {
true
}
}