From d7452a6c54f18e901186cc00e6e613d14e00bb1c Mon Sep 17 00:00:00 2001 From: NingBo Wang <2536935847@qq.com> Date: Thu, 25 Apr 2024 19:05:07 +0800 Subject: [PATCH] Slpx adds InsufficientAssets event (#1233) --- pallets/slpx/src/lib.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pallets/slpx/src/lib.rs b/pallets/slpx/src/lib.rs index c533e77d3..4ce0eb2d6 100644 --- a/pallets/slpx/src/lib.rs +++ b/pallets/slpx/src/lib.rs @@ -235,6 +235,7 @@ pub mod pallet { OrderFailed { order: Order, CurrencyIdOf, BalanceOf, BlockNumberFor>, }, + InsufficientAssets, } #[pallet::error] @@ -372,11 +373,14 @@ pub mod pallet { // Will not check results and will be sent regardless of the success of // the burning - let _ = T::MultiCurrency::withdraw( + let result = T::MultiCurrency::withdraw( target_fee_currency_id, &T::TreasuryAccount::get(), BalanceOf::::unique_saturated_from(configuration.xcm_fee), ); + if result.is_err() { + Self::deposit_event(Event::InsufficientAssets); + } configuration.last_block = n; XcmEthereumCallConfiguration::::put(configuration);