diff --git a/polkadot/xcm/xcm-executor/src/lib.rs b/polkadot/xcm/xcm-executor/src/lib.rs index 9e2a5e918bc8..145c5b3ae4f9 100644 --- a/polkadot/xcm/xcm-executor/src/lib.rs +++ b/polkadot/xcm/xcm-executor/src/lib.rs @@ -90,6 +90,7 @@ pub struct XcmExecutor { /// Stores the current message's weight. message_weight: Weight, _config: PhantomData, + assetClaimer: Option, } #[cfg(any(test, feature = "runtime-benchmarks"))] @@ -357,7 +358,11 @@ impl XcmExecutor { original_origin = ?self.original_origin, "Trapping assets in holding register", ); - let effective_origin = self.context.origin.as_ref().unwrap_or(&self.original_origin); + let effective_orgin = if let Some(assetClaimer) = self.assetClaimer { + assetClaimer.as_ref().unwrap_or(&self.original_origin) + } else { + self.context.origin.as_ref().unwrap_or(&self.original_origin) + }; let trap_weight = Config::AssetTrap::drop_assets(effective_origin, self.holding, &self.context); weight_used.saturating_accrue(trap_weight); @@ -1065,6 +1070,10 @@ impl XcmExecutor { self.error = None; Ok(()) }, + SetAssetClaimer { location } => { + self.assetClaimer = Some(location); + Ok(()) + }, ClaimAsset { assets, ticket } => { let origin = self.origin_ref().ok_or(XcmError::BadOrigin)?; self.ensure_can_subsume_assets(assets.len())?;