From 8d768a8ea664df322678aa1aced5d066e1b5037a Mon Sep 17 00:00:00 2001 From: nakul1010 Date: Mon, 4 Dec 2023 15:04:17 +0530 Subject: [PATCH] fix: change error type. --- crates/fee/src/lib.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/crates/fee/src/lib.rs b/crates/fee/src/lib.rs index 96523f0149..0185a1d54b 100644 --- a/crates/fee/src/lib.rs +++ b/crates/fee/src/lib.rs @@ -38,7 +38,7 @@ pub use pallet::*; use primitives::VaultId; use reward::RewardsApi; use sp_arithmetic::{traits::*, FixedPointNumber}; -use sp_runtime::{traits::AccountIdConversion, TransactionOutcome}; +use sp_runtime::{traits::AccountIdConversion, ArithmeticError, TransactionOutcome}; use sp_std::{ convert::{TryFrom, TryInto}, fmt::Debug, @@ -111,8 +111,6 @@ pub mod pallet { TryIntoIntError, /// Value exceeds the expected upper bound for storage fields in this pallet. AboveMaxExpectedValue, - /// Subtraction of the premium redeem fee from a value failed. - PremiumRedeemSubtractionFailed, } #[pallet::hooks] @@ -439,7 +437,7 @@ impl Pallet { ) -> Result, DispatchError> { Ok(amount .checked_sub(&>::get()) - .ok_or(Error::::PremiumRedeemSubtractionFailed)?) + .ok_or(ArithmeticError::Underflow)?) } /// Calculate punishment fee for a Vault that fails to execute a redeem