From 2a646311d6d736c623e0b5d847fce5a1fb95c1dd Mon Sep 17 00:00:00 2001 From: ron Date: Wed, 3 Apr 2024 21:39:46 +0800 Subject: [PATCH] Charge price for the sender cost --- polkadot/xcm/pallet-xcm/src/ethereum.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/polkadot/xcm/pallet-xcm/src/ethereum.rs b/polkadot/xcm/pallet-xcm/src/ethereum.rs index 2a63f7cbe9bd..227e9ae68caf 100644 --- a/polkadot/xcm/pallet-xcm/src/ethereum.rs +++ b/polkadot/xcm/pallet-xcm/src/ethereum.rs @@ -1,4 +1,6 @@ -use crate::{Box, Config, Error, Event, FeesHandling, Instruction::BurnAsset, Pallet, Vec, Xcm}; +use crate::{ + vec, Box, Config, Error, Event, FeesHandling, Instruction::BurnAsset, Pallet, Vec, Xcm, +}; use codec::Encode; use frame_support::{ dispatch::DispatchResult, @@ -170,10 +172,15 @@ impl Pallet { })?; if let Some(remote_xcm) = remote_xcm { - let (ticket, _) = validate_send::(dest.clone(), remote_xcm.clone()) + let (ticket, price) = validate_send::(dest.clone(), remote_xcm.clone()) .map_err(Error::::from)?; if origin != Here.into_location() { - Self::charge_fees(origin.clone(), fees).map_err(|error| { + let total_fees: Assets = vec![fees, price] + .iter() + .flat_map(|s| s.clone().into_inner()) + .collect::>() + .into(); + Self::charge_fees(origin.clone(), total_fees).map_err(|error| { log::error!( target: "xcm::pallet_xcm::execute_xcm_transfer", "Unable to charge fee with error {:?}", error