From ba4740b205b3595a5c8c85421b2ffdd510e1b949 Mon Sep 17 00:00:00 2001 From: SunTiebing <1045060705@qq.com> Date: Tue, 31 Dec 2024 16:08:13 +0800 Subject: [PATCH] change div to checked_div method --- pallets/channel-commission/src/mock.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pallets/channel-commission/src/mock.rs b/pallets/channel-commission/src/mock.rs index 90270b949b..6a9b86b4f6 100644 --- a/pallets/channel-commission/src/mock.rs +++ b/pallets/channel-commission/src/mock.rs @@ -32,9 +32,7 @@ use frame_support::{ }; use frame_system::EnsureSignedBy; use sp_core::ConstU32; -use sp_runtime::traits::Scale; use sp_runtime::{traits::AccountIdConversion, AccountId32, BuildStorage, DispatchError}; -use std::ops::Div; pub type BlockNumber = u64; pub type Amount = i128; @@ -185,7 +183,7 @@ impl VtokenMintingInterface for SimpleVtokenMint _vtoken_id: CurrencyId, token_amount: Balance, ) -> Result { - Ok(token_amount.div(2u64)) + Ok(token_amount.checked_div(2u64).unwrap()) } fn get_currency_amount_by_v_currency_amount(