@@ -298,6 +298,11 @@ pub mod pallet {
298298 from : AssetAmount < T :: AssetId > ,
299299 to : AssetAmount < T :: AssetId > ,
300300 } ,
301+ /// A pending asset could not be converted; skipped, not blocking.
302+ ConversionFailed {
303+ asset_id : T :: AssetId ,
304+ reason : DispatchError ,
305+ } ,
301306 /// Rewards claimed.
302307 Claimed {
303308 who : T :: AccountId ,
@@ -484,12 +489,17 @@ pub mod pallet {
484489 let asset_balance = T :: Currency :: balance ( asset_id. clone ( ) , & Self :: pot_account_id ( ) ) ;
485490 // Best-effort, like `on_idle`: skip an un-convertible slice rather than revert the
486491 // whole claim. Funds stay in the pot and re-queue on the next fee.
487- let _ = T :: Convert :: convert (
492+ if let Err ( reason ) = T :: Convert :: convert (
488493 Self :: pot_account_id ( ) ,
489494 asset_id. clone ( ) ,
490495 T :: RewardAsset :: get ( ) ,
491496 asset_balance,
492- ) ;
497+ ) {
498+ Self :: deposit_event ( Event :: ConversionFailed {
499+ asset_id : asset_id. clone ( ) ,
500+ reason,
501+ } ) ;
502+ }
493503 PendingConversions :: < T > :: remove ( asset_id) ;
494504 }
495505 let referrer_shares = ReferrerShares :: < T > :: take ( & who) ;
@@ -616,12 +626,17 @@ pub mod pallet {
616626 for asset_id in PendingConversions :: < T > :: iter_keys ( ) . take ( max_converts as usize ) {
617627 let asset_balance = T :: Currency :: balance ( asset_id. clone ( ) , & Self :: pot_account_id ( ) ) ;
618628 // remove the asset_id from PendingConversions even when the conversion fails
619- let _ = T :: Convert :: convert (
629+ if let Err ( reason ) = T :: Convert :: convert (
620630 Self :: pot_account_id ( ) ,
621631 asset_id. clone ( ) ,
622632 T :: RewardAsset :: get ( ) ,
623633 asset_balance,
624- ) ;
634+ ) {
635+ Self :: deposit_event ( Event :: ConversionFailed {
636+ asset_id : asset_id. clone ( ) ,
637+ reason,
638+ } ) ;
639+ }
625640 PendingConversions :: < T > :: remove ( asset_id) ;
626641 actual_converts += 1 ;
627642 }
0 commit comments