Skip to content

Commit 414be35

Browse files
Merge pull request #133 from claravanstaden/release/testnet
Fix IsForeignConcreteAssetFrom and add more logging
2 parents 29637fc + 8aae42f commit 414be35

File tree

4 files changed

+41
-21
lines changed

4 files changed

+41
-21
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

runtime/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "neuroweb-runtime"
3-
version = "143.0.0"
3+
version = "144.0.0"
44
authors = ["TraceLabs"]
55
description = "NeuroWeb Runtime - Cumulus FRAME-based Substrate Runtime"
66
license = "GPL-3.0-only"

runtime/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
152152
spec_name: create_runtime_str!("origintrail-parachain"),
153153
impl_name: create_runtime_str!("neuroweb"),
154154
authoring_version: 1,
155-
spec_version: 143,
155+
spec_version: 144,
156156
impl_version: 0,
157157
apis: RUNTIME_API_VERSIONS,
158158
transaction_version: 1,

runtime/src/xcm_config.rs

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -209,23 +209,28 @@ impl DropAssets for DealWithForeignFees {
209209
if let Fungible(amount) = asset.fun {
210210
if amount > 0 {
211211
// Credit Treasury account in pallet-assets (asset_id = Location)
212-
if ForeignAssets::mint_into(
212+
match ForeignAssets::mint_into(
213213
RelayLocation::get(), // directly use Location as ID
214214
&crate::Treasury::account_id(),
215215
amount,
216-
)
217-
.is_ok()
218-
{
219-
log::info!(
220-
target: "xcm::fees",
221-
"Credited {} DOT into Treasury account",
222-
amount
223-
);
224-
} else {
225-
log::warn!(
226-
target: "xcm::fees",
227-
"Failed to credit DOT fees into Treasury"
228-
);
216+
) {
217+
Ok(_) => {
218+
log::info!(
219+
target: "xcm::fees",
220+
"Credited {} DOT into Treasury account ({:?})",
221+
amount,
222+
&crate::Treasury::account_id(),
223+
);
224+
}
225+
Err(e) => {
226+
log::warn!(
227+
target: "xcm::fees",
228+
"Failed to credit DOT fees ({}) into Treasury ({:?}): {:?}",
229+
amount,
230+
&crate::Treasury::account_id(),
231+
e
232+
);
233+
}
229234
}
230235
}
231236
}
@@ -329,13 +334,28 @@ where
329334
Origin: Get<Location>,
330335
{
331336
fn matches_fungibles(asset: &Asset) -> Result<(Location, u128), MatchError> {
332-
let loc = Origin::get();
337+
let expected_origin = Origin::get();
338+
339+
let AssetId(asset_location) = &asset.id;
340+
341+
// Ensure DOT comes from Asset Hub
342+
if *asset_location == RelayLocation::get() && expected_origin == AssetHubLocation::get() {
343+
if let Fungible(amount) = asset.fun {
344+
return Ok((asset_location.clone(), amount));
345+
}
346+
}
333347

334-
if asset.id == AssetId(loc.clone()) {
335-
if let Fungibility::Fungible(amount) = asset.fun {
336-
return Ok((loc, amount));
348+
// Handle assets from Ethereum
349+
if expected_origin == AssetHubLocation::get() && asset_location.parents == 2 {
350+
if let Some(first_junction) = asset_location.interior.first() {
351+
if matches!(first_junction, GlobalConsensus(Ethereum { .. })) {
352+
if let Fungible(amount) = asset.fun {
353+
return Ok((asset_location.clone(), amount));
354+
}
355+
}
337356
}
338357
}
358+
339359
Err(MatchError::AssetNotHandled)
340360
}
341361
}

0 commit comments

Comments
 (0)