@@ -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