@@ -29,7 +29,7 @@ use frame_support::{
2929use sp_core:: defer;
3030use sp_io:: hashing:: blake2_128;
3131use sp_weights:: Weight ;
32- use xcm:: latest:: prelude:: * ;
32+ use xcm:: { latest:: prelude:: * , v3 :: MultiLocation } ;
3333
3434pub mod traits;
3535use traits:: {
@@ -84,6 +84,7 @@ pub struct XcmExecutor<Config: config::Config> {
8484 transact_status : MaybeErrorCode ,
8585 fees_mode : FeesMode ,
8686 _config : PhantomData < Config > ,
87+ assetClaimer : Option < Location > ,
8788}
8889
8990#[ cfg( feature = "runtime-benchmarks" ) ]
@@ -342,7 +343,11 @@ impl<Config: config::Config> XcmExecutor<Config> {
342343 original_origin = ?self . original_origin,
343344 "Trapping assets in holding register" ,
344345 ) ;
345- let effective_origin = self . context . origin . as_ref ( ) . unwrap_or ( & self . original_origin ) ;
346+ let effective_orgin = if let Some ( assetClaimer) = self . assetClaimer {
347+ assetClaimer. as_ref ( ) . unwrap_or ( & self . original_origin )
348+ } else {
349+ self . context . origin . as_ref ( ) . unwrap_or ( & self . original_origin )
350+ } ;
346351 let trap_weight =
347352 Config :: AssetTrap :: drop_assets ( effective_origin, self . holding , & self . context ) ;
348353 weight_used. saturating_accrue ( trap_weight) ;
@@ -1003,6 +1008,10 @@ impl<Config: config::Config> XcmExecutor<Config> {
10031008 self . error = None ;
10041009 Ok ( ( ) )
10051010 } ,
1011+ SetAssetClaimer { location } => {
1012+ self . assetClaimer = Some ( location) ;
1013+ Ok ( ( ) )
1014+ }
10061015 ClaimAsset { assets, ticket } => {
10071016 let origin = self . origin_ref ( ) . ok_or ( XcmError :: BadOrigin ) ?;
10081017 self . ensure_can_subsume_assets ( assets. len ( ) ) ?;
0 commit comments