Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -18,33 +18,24 @@ use sp_keyring::Sr25519Keyring as Keyring;

// Cumulus
use emulated_integration_tests_common::{
accounts, build_genesis_storage, collators, xcm_emulator::ConvertLocation, RESERVABLE_ASSET_ID,
accounts, build_genesis_storage, collators, xcm_emulator::ConvertLocation, PenpalALocation,
PenpalASiblingSovereignAccount, PenpalATeleportableAssetLocation, RESERVABLE_ASSET_ID,
SAFE_XCM_VERSION,
};
use frame_support::sp_runtime::traits::AccountIdConversion;
use integration_tests_helpers::common::snowbridge::{EthLocation, WethLocation, MIN_ETHER_BALANCE};
use parachains_common::{AccountId, Balance};
use polkadot_parachain_primitives::primitives::Sibling;
use xcm::prelude::*;
use xcm_builder::GlobalConsensusParachainConvertsFor;
use xcm_builder::ExternalConsensusLocationsConverterFor;

pub const PARA_ID: u32 = 1000;
pub const ED: Balance = asset_hub_kusama_runtime::ExistentialDeposit::get();
pub const USDT_ID: u32 = 1984;

frame_support::parameter_types! {
pub AssetHubKusamaAssetOwner: AccountId = Keyring::Alice.to_account_id();
pub PenpalATeleportableAssetLocation: Location
= Location::new(1, [
Parachain(penpal_emulated_chain::PARA_ID_A),
PalletInstance(penpal_emulated_chain::ASSETS_PALLET_ID),
GeneralIndex(penpal_emulated_chain::TELEPORTABLE_ASSET_ID.into()),
]
);
pub UniversalLocation: InteriorLocation = [GlobalConsensus(Kusama), Parachain(PARA_ID)].into();
pub AssetHubPolkadotLocation: Location = Location::new(2, [GlobalConsensus(Polkadot), Parachain(1000)]);
pub PenpalASiblingSovereignAccount: AccountId = Sibling::from(penpal_emulated_chain::PARA_ID_A).into_account_truncating();
pub AssetHubPolkadotSovereignAccount: AccountId = GlobalConsensusParachainConvertsFor::<UniversalLocation, AccountId>::convert_location(
pub AssetHubPolkadotSovereignAccount: AccountId = ExternalConsensusLocationsConverterFor::<UniversalLocation, AccountId>::convert_location(
&AssetHubPolkadotLocation::get(),
).unwrap();
}
Expand Down Expand Up @@ -117,6 +108,14 @@ pub fn genesis() -> sp_core::storage::Storage {
MIN_ETHER_BALANCE,
),
],
reserves: vec![
(
PenpalATeleportableAssetLocation::get(),
vec![(PenpalALocation::get(), true).into()],
),
(EthLocation::get(), vec![(AssetHubPolkadotLocation::get(), false).into()]),
(WethLocation::get(), vec![(AssetHubPolkadotLocation::get(), false).into()]),
],
..Default::default()
},
..Default::default()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ use emulated_integration_tests_common::{
};
use kusama_emulated_chain::Kusama;

pub use assets_common::local_and_foreign_assets::ForeignAssetReserveData;

// AssetHubKusama Parachain declaration
decl_test_parachains! {
pub struct AssetHubKusama {
Expand Down Expand Up @@ -60,6 +62,6 @@ impl_assets_helpers_for_parachain!(AssetHubKusama);
impl_foreign_assets_helpers_for_parachain!(
AssetHubKusama,
xcm::latest::Location,
assets_common::local_and_foreign_assets::ForeignAssetReserveData
ForeignAssetReserveData
);
impl_xcm_helpers_for_parachain!(AssetHubKusama);
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ parachains-common = { workspace = true, default-features = true }
cumulus-primitives-core = { workspace = true, default-features = true }
emulated-integration-tests-common = { workspace = true }
xcm = { workspace = true, default-features = true }
xcm-builder = { workspace = true, default-features = true }
polkadot-parachain-primitives = { workspace = true }

# Runtimes
Expand All @@ -46,4 +47,5 @@ runtime-benchmarks = [
"polkadot-parachain-primitives/runtime-benchmarks",
"snowbridge-inbound-queue-primitives/runtime-benchmarks",
"xcm/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
]
Original file line number Diff line number Diff line change
Expand Up @@ -17,45 +17,26 @@
use sp_keyring::{Ed25519Keyring, Sr25519Keyring};

// Cumulus
use asset_hub_polkadot_runtime::xcm_config::bridging::to_ethereum::EthereumNetwork;
use emulated_integration_tests_common::{
accounts, build_genesis_storage, xcm_emulator::ConvertLocation, RESERVABLE_ASSET_ID,
accounts, build_genesis_storage, xcm_emulator::ConvertLocation, PenpalALocation,
PenpalASiblingSovereignAccount, PenpalATeleportableAssetLocation, PenpalBLocation,
PenpalBSiblingSovereignAccount, PenpalBTeleportableAssetLocation, RESERVABLE_ASSET_ID,
SAFE_XCM_VERSION,
};
use frame_support::sp_runtime::traits::AccountIdConversion;
use integration_tests_helpers::common::snowbridge::{EthLocation, WethLocation, MIN_ETHER_BALANCE};
use parachains_common::{AccountId, Balance};
use polkadot_parachain_primitives::primitives::Sibling;
use snowbridge_inbound_queue_primitives::EthereumLocationsConverterFor;
use xcm::prelude::*;
use xcm_builder::ExternalConsensusLocationsConverterFor;

pub const PARA_ID: u32 = 1000;
pub const ED: Balance = asset_hub_polkadot_runtime::ExistentialDeposit::get();
pub const USDT_ID: u32 = 1984;

frame_support::parameter_types! {
pub AssetHubPolkadotAssetOwner: AccountId = Sr25519Keyring::Alice.to_account_id();
pub PenpalATeleportableAssetLocation: Location
= Location::new(1, [
Parachain(penpal_emulated_chain::PARA_ID_A),
PalletInstance(penpal_emulated_chain::ASSETS_PALLET_ID),
GeneralIndex(penpal_emulated_chain::TELEPORTABLE_ASSET_ID.into()),
]
);
pub PenpalBTeleportableAssetLocation: Location
= Location::new(1, [
Parachain(penpal_emulated_chain::PARA_ID_B),
PalletInstance(penpal_emulated_chain::ASSETS_PALLET_ID),
GeneralIndex(penpal_emulated_chain::TELEPORTABLE_ASSET_ID.into()),
]
);
pub PenpalASiblingSovereignAccount: AccountId = Sibling::from(penpal_emulated_chain::PARA_ID_A).into_account_truncating();
pub PenpalBSiblingSovereignAccount: AccountId = Sibling::from(penpal_emulated_chain::PARA_ID_B).into_account_truncating();
pub EthereumSovereignAccount: AccountId = EthereumLocationsConverterFor::<AccountId>::convert_location(
&Location::new(
2,
[GlobalConsensus(EthereumNetwork::get())],
),
pub UniversalLocation: InteriorLocation = [GlobalConsensus(Polkadot), Parachain(PARA_ID)].into();
pub EthereumSovereignAccount: AccountId = ExternalConsensusLocationsConverterFor::<UniversalLocation, AccountId>::convert_location(
&EthLocation::get(),
).unwrap();
}

Expand Down Expand Up @@ -137,6 +118,18 @@ pub fn genesis() -> sp_core::storage::Storage {
// Weth
(WethLocation::get(), EthereumSovereignAccount::get(), true, MIN_ETHER_BALANCE),
],
reserves: vec![
(
PenpalATeleportableAssetLocation::get(),
vec![(PenpalALocation::get(), true).into()],
),
(
PenpalBTeleportableAssetLocation::get(),
vec![(PenpalBLocation::get(), true).into()],
),
(EthLocation::get(), vec![(EthLocation::get(), false).into()]),
(WethLocation::get(), vec![(EthLocation::get(), false).into()]),
],
..Default::default()
},
..Default::default()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ use emulated_integration_tests_common::{
};
use polkadot_emulated_chain::Polkadot;

pub use assets_common::local_and_foreign_assets::ForeignAssetReserveData;

// AssetHubPolkadot Parachain declaration
decl_test_parachains! {
pub struct AssetHubPolkadot {
Expand Down Expand Up @@ -62,6 +64,6 @@ impl_assets_helpers_for_parachain!(AssetHubPolkadot);
impl_foreign_assets_helpers_for_parachain!(
AssetHubPolkadot,
xcm::latest::Location,
assets_common::local_and_foreign_assets::ForeignAssetReserveData
ForeignAssetReserveData
);
impl_xcm_helpers_for_parachain!(AssetHubPolkadot);
1 change: 1 addition & 0 deletions integration-tests/emulated/helpers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ pub use xcm_emulator::Chain;

pub mod common;

// TODO: remove, use from SDK
#[macro_export]
macro_rules! test_relay_is_trusted_teleporter {
( $sender_relay:ty, vec![$( $receiver_para:ty ),+], ($assets:expr, $amount:expr), $xcm_call:ident ) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ hex-literal = { workspace = true }
# Substrate
sp-runtime = { workspace = true, default-features = true }
frame-support = { workspace = true, default-features = true }
frame-system = { workspace = true, default-features = true }
pallet-assets = { workspace = true, default-features = true }
pallet-balances = { workspace = true, default-features = true }
pallet-asset-conversion = { workspace = true, default-features = true }
Expand Down Expand Up @@ -48,6 +49,7 @@ runtime-benchmarks = [
"asset-hub-kusama-runtime/runtime-benchmarks",
"cumulus-pallet-parachain-system/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"integration-tests-helpers/runtime-benchmarks",
"kusama-runtime-constants/runtime-benchmarks",
"kusama-runtime/runtime-benchmarks",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ pub use frame_support::{
pallet_prelude::Weight,
sp_runtime::{AccountId32, DispatchError, DispatchResult},
traits::fungibles::Inspect,
BoundedVec,
};
pub use sp_runtime::traits::Dispatchable;

Expand All @@ -33,7 +34,7 @@ pub use xcm::{
pub use xcm_executor::traits::TransferType;

// Cumulus
pub use asset_hub_kusama_runtime::xcm_config::XcmConfig as AssetHubKusamaXcmConfig;
pub use asset_hub_kusama_runtime::xcm_config::{KsmLocation, XcmConfig as AssetHubKusamaXcmConfig};
pub use asset_test_utils::xcm_helpers;
pub use emulated_integration_tests_common::{
test_parachain_is_trusted_teleporter,
Expand All @@ -51,12 +52,18 @@ pub use kusama_runtime::xcm_config::UniversalLocation as KusamaUniversalLocation
pub use kusama_system_emulated_network::{
asset_hub_kusama_emulated_chain::{
genesis::{AssetHubKusamaAssetOwner, ED as ASSET_HUB_KUSAMA_ED},
AssetHubKusamaParaPallet as AssetHubKusamaPallet,
AssetHubKusamaParaPallet as AssetHubKusamaPallet, ForeignAssetReserveData,
},
bridge_hub_kusama_emulated_chain::BridgeHubKusamaParaPallet as BridgeHubKusamaPallet,
coretime_kusama_emulated_chain::CoretimeKusamaParaPallet as CoretimeKusamaPallet,
kusama_emulated_chain::{genesis::ED as KUSAMA_ED, KusamaRelayPallet as KusamaPallet},
penpal_emulated_chain::{
penpal_runtime::xcm_config::{
LocalReservableFromAssetHub as PenpalLocalReservableFromAssetHub,
LocalTeleportableToAssetHub as PenpalLocalTeleportableToAssetHub,
UniversalLocation as PenpalUniversalLocation,
UsdtFromAssetHub as PenpalUsdtFromAssetHub,
},
CustomizableAssetFromSystemAssetHub, PenpalAParaPallet as PenpalAPallet, PenpalAssetOwner,
PenpalBParaPallet as PenpalBPallet, ED as PENPAL_ED,
},
Expand Down
Loading
Loading