Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

feat: add bridged adapter #336

Merged
merged 2 commits into from
Feb 7, 2024
Merged
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
1 change: 1 addition & 0 deletions runtime/trappist/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ pallet-tx-pause = { workspace = true }
[features]
default = ["std"]
std = [
"hex-literal",
"parity-scale-codec/std",
"serde",
"scale-info/std",
Expand Down
6 changes: 3 additions & 3 deletions runtime/trappist/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ impl frame_support::traits::OnRuntimeUpgrade for FixStorageVersions {

let mut writes = 0;

/// trappist-rococo runtime v.11000 has an incorrect on-chain storage version of 0 for the Uniques pallet
/// Set the Uniques pallet's storage version to 1 as expected.
// trappist-rococo runtime v.11000 has an incorrect on-chain storage version of 0 for the Uniques pallet
// Set the Uniques pallet's storage version to 1 as expected.
if Uniques::on_chain_storage_version() == StorageVersion::new(0) {
Uniques::current_storage_version().put::<Uniques>();
writes.saturating_inc();
Expand All @@ -142,7 +142,7 @@ impl frame_support::traits::OnRuntimeUpgrade for FixStorageVersions {
}
}

pub type Migrations = (FixStorageVersions);
pub type Migrations = FixStorageVersions;

/// Executive: handles dispatch to the various modules.
pub type Executive = frame_executive::Executive<
Expand Down
24 changes: 22 additions & 2 deletions runtime/trappist/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ use xcm_builder::{
};
use xcm_executor::{traits::JustTry, XcmExecutor};

use hex_literal::hex;
use xcm_primitives::{AsAssetMultiLocation, ConvertedRegisteredAssetId, TrappistDropAssets};

use crate::{
Expand All @@ -62,6 +63,7 @@ parameter_types! {
pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into();
pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();
pub SelfReserve: MultiLocation = MultiLocation::here();
pub EthereumCurrencyLocation: MultiLocation = MultiLocation::new(2, X2(GlobalConsensus(Ethereum { chain_id: 11155111 }), AccountKey20{ network: None, key: hex!("c9F05326311bc2a55426761Bec20057685FB80f7") }));
pub AssetsPalletLocation: MultiLocation =
PalletInstance(<Assets as PalletInfoAccess>::index() as u8).into();
// Be mindful with incoming teleports if you implement this
Expand Down Expand Up @@ -113,6 +115,20 @@ pub type LocalAssetTransactor = CurrencyAdapter<
(),
>;

/// Means for transacting the native currency on this chain.
pub type BridgedLocalAssetTransactor = CurrencyAdapter<
// Use this currency:
Balances,
// Use this currency when it is a fungible asset matching the given location or name:
IsConcrete<EthereumCurrencyLocation>,
// Convert an XCM MultiLocation into a local account id:
LocationToAccountId,
// Our chain's account ID type (we can't get away without mentioning it explicitly):
AccountId,
// We don't track any teleports.
(),
>;

/// Means for transacting assets besides the native currency on this chain.
pub type LocalFungiblesTransactor = FungiblesAdapter<
// Use this fungibles implementation:
Expand Down Expand Up @@ -155,8 +171,12 @@ pub type ReservedFungiblesTransactor = FungiblesAdapter<
>;

/// Means for transacting assets on this chain.
pub type AssetTransactors =
(LocalAssetTransactor, ReservedFungiblesTransactor, LocalFungiblesTransactor);
pub type AssetTransactors = (
LocalAssetTransactor,
BridgedLocalAssetTransactor,
ReservedFungiblesTransactor,
LocalFungiblesTransactor,
);

/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,
/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can
Expand Down
Loading