referrerpolicy=no-referrer-when-downgrade

asset_hub_rococo_integration_tests/
lib.rs

1// Copyright (C) Parity Technologies (UK) Ltd.
2// SPDX-License-Identifier: Apache-2.0
3
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// 	http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16#[cfg(test)]
17mod imports {
18	pub(crate) use codec::Encode;
19
20	// Substrate
21	pub(crate) use frame_support::{
22		assert_err, assert_ok,
23		pallet_prelude::Weight,
24		sp_runtime::{DispatchError, DispatchResult, ModuleError},
25		traits::fungibles::Inspect,
26	};
27
28	// Polkadot
29	pub(crate) use xcm::{
30		latest::{ROCOCO_GENESIS_HASH, WESTEND_GENESIS_HASH},
31		prelude::{AccountId32 as AccountId32Junction, *},
32	};
33	pub(crate) use xcm_executor::traits::TransferType;
34
35	// Cumulus
36	pub(crate) use asset_test_utils::xcm_helpers;
37	pub(crate) use emulated_integration_tests_common::{
38		accounts::DUMMY_EMPTY,
39		test_parachain_is_trusted_teleporter, test_parachain_is_trusted_teleporter_for_relay,
40		test_relay_is_trusted_teleporter, test_xcm_fee_querying_apis_work_for_asset_hub,
41		xcm_emulator::{
42			assert_expected_events, bx, Chain, Parachain as Para, RelayChain as Relay, Test,
43			TestArgs, TestContext, TestExt,
44		},
45		xcm_helpers::{
46			fee_asset, get_amount_from_versioned_assets, non_fee_asset, xcm_transact_paid_execution,
47		},
48		PenpalATeleportableAssetLocation, ASSETS_PALLET_ID, RESERVABLE_ASSET_ID, XCM_V3,
49	};
50	pub(crate) use parachains_common::Balance;
51	pub(crate) use rococo_system_emulated_network::{
52		asset_hub_rococo_emulated_chain::{
53			asset_hub_rococo_runtime::{
54				self,
55				xcm_config::{
56					self as ahr_xcm_config, TokenLocation as RelayLocation, TreasuryAccount,
57					XcmConfig as AssetHubRococoXcmConfig,
58				},
59				AssetConversionOrigin as AssetHubRococoAssetConversionOrigin,
60				ExistentialDeposit as AssetHubRococoExistentialDeposit,
61			},
62			genesis::{AssetHubRococoAssetOwner, ED as ASSET_HUB_ROCOCO_ED},
63			AssetHubRococoParaPallet as AssetHubRococoPallet,
64		},
65		penpal_emulated_chain::{
66			penpal_runtime::xcm_config::{
67				CustomizableAssetFromSystemAssetHub as PenpalCustomizableAssetFromSystemAssetHub,
68				LocalReservableFromAssetHub as PenpalLocalReservableFromAssetHub,
69				LocalTeleportableToAssetHub as PenpalLocalTeleportableToAssetHub,
70				UsdtFromAssetHub as PenpalUsdtFromAssetHub,
71			},
72			PenpalAParaPallet as PenpalAPallet, PenpalAssetOwner,
73			PenpalBParaPallet as PenpalBPallet, ED as PENPAL_ED,
74		},
75		rococo_emulated_chain::{
76			genesis::ED as ROCOCO_ED,
77			rococo_runtime::{
78				governance as rococo_governance,
79				governance::pallet_custom_origins::Origin::Treasurer,
80				xcm_config::UniversalLocation as RococoUniversalLocation, Dmp,
81				OriginCaller as RococoOriginCaller,
82			},
83			RococoRelayPallet as RococoPallet,
84		},
85		AssetHubRococoPara as AssetHubRococo, AssetHubRococoParaReceiver as AssetHubRococoReceiver,
86		AssetHubRococoParaSender as AssetHubRococoSender, BridgeHubRococoPara as BridgeHubRococo,
87		BridgeHubRococoParaReceiver as BridgeHubRococoReceiver, PenpalAPara as PenpalA,
88		PenpalAParaReceiver as PenpalAReceiver, PenpalAParaSender as PenpalASender,
89		PenpalBPara as PenpalB, PenpalBParaReceiver as PenpalBReceiver, RococoRelay as Rococo,
90		RococoRelayReceiver as RococoReceiver, RococoRelaySender as RococoSender,
91	};
92
93	pub(crate) const ASSET_ID: u32 = 3;
94	pub(crate) const ASSET_MIN_BALANCE: u128 = 1000;
95
96	pub(crate) type RelayToParaTest = Test<Rococo, PenpalA>;
97	pub(crate) type ParaToRelayTest = Test<PenpalA, Rococo>;
98	pub(crate) type SystemParaToRelayTest = Test<AssetHubRococo, Rococo>;
99	pub(crate) type SystemParaToParaTest = Test<AssetHubRococo, PenpalA>;
100	pub(crate) type ParaToSystemParaTest = Test<PenpalA, AssetHubRococo>;
101	pub(crate) type ParaToParaThroughRelayTest = Test<PenpalA, PenpalB, Rococo>;
102	pub(crate) type ParaToParaThroughAHTest = Test<PenpalA, PenpalB, AssetHubRococo>;
103	pub(crate) type RelayToParaThroughAHTest = Test<Rococo, PenpalA, AssetHubRococo>;
104}
105
106#[cfg(test)]
107mod tests;