From 72b27a6889d34cee605648f4a7e73cad179d5b4d Mon Sep 17 00:00:00 2001 From: Alexander Krupenkin Date: Thu, 13 Feb 2025 13:16:30 +0300 Subject: [PATCH] Added bridged currency transactor --- runtime/main/src/lib.rs | 2 +- runtime/main/src/xcm_config.rs | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/runtime/main/src/lib.rs b/runtime/main/src/lib.rs index 87fe9648..19f5a849 100644 --- a/runtime/main/src/lib.rs +++ b/runtime/main/src/lib.rs @@ -85,7 +85,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("robonomics"), impl_name: create_runtime_str!("robonomics-airalab"), authoring_version: 1, - spec_version: 34, + spec_version: 35, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1, diff --git a/runtime/main/src/xcm_config.rs b/runtime/main/src/xcm_config.rs index 6fcca0b2..1867cf62 100644 --- a/runtime/main/src/xcm_config.rs +++ b/runtime/main/src/xcm_config.rs @@ -52,6 +52,7 @@ parameter_types! { pub UniversalLocation: InteriorMultiLocation = X2(GlobalConsensus(RelayNetwork::get()), Parachain(ParachainInfo::parachain_id().into())); pub Local: MultiLocation = Here.into_location(); + pub EthereumCurrencyLocation: MultiLocation = MultiLocation::new(2, X2(GlobalConsensus(Ethereum { chain_id: 1 }), AccountKey20{ network: None, key: hex!("7de91b204c1c737bcee6f000aaa6569cf7061cb7") })); pub AssetsPalletLocation: MultiLocation = PalletInstance(::index() as u8).into(); pub DummyCheckingAccount: AccountId = PolkadotXcm::check_account(); @@ -101,8 +102,26 @@ pub type FungiblesTransactor = FungiblesAdapter< DummyCheckingAccount, >; +/// Means for transacting the native currency on this chain. +pub type BridgedCurrencyTransactor = CurrencyAdapter< + // Use this currency: + Balances, + // Use this currency when it is a fungible asset matching the given location or name: + IsConcrete, + // 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 on this chain. -pub type AssetTransactors = (CurrencyTransactor, FungiblesTransactor); +pub type AssetTransactors = ( + CurrencyTransactor, + BridgedCurrencyTransactor, + FungiblesTransactor, +); /// 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