From e068c34665b46c60f5aecca6b1b576e952453e92 Mon Sep 17 00:00:00 2001 From: yooml Date: Thu, 8 Feb 2024 16:24:18 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20force=5Fupdate=5Fmarket?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pallets/lend-market/src/lib.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/pallets/lend-market/src/lib.rs b/pallets/lend-market/src/lib.rs index 6ae64323e..5c4376002 100644 --- a/pallets/lend-market/src/lib.rs +++ b/pallets/lend-market/src/lib.rs @@ -663,6 +663,27 @@ pub mod pallet { ) -> DispatchResultWithPostInfo { T::UpdateOrigin::ensure_origin(origin)?; ensure!(market.rate_model.check_model(), Error::::InvalidRateModelParam); + ensure!( + market.collateral_factor >= Ratio::zero() && + market.collateral_factor < Ratio::one(), + Error::::InvalidFactor, + ); + ensure!( + market.liquidation_threshold < Ratio::one() && + market.liquidation_threshold >= market.collateral_factor, + Error::::InvalidFactor + ); + ensure!( + market.reserve_factor > Ratio::zero() && market.reserve_factor < Ratio::one(), + Error::::InvalidFactor, + ); + ensure!( + market.liquidate_incentive_reserved_factor > Ratio::zero() && + market.liquidate_incentive_reserved_factor < Ratio::one(), + Error::::InvalidFactor, + ); + ensure!(market.supply_cap > Zero::zero(), Error::::InvalidSupplyCap,); + if UnderlyingAssetId::::contains_key(market.lend_token_id) { ensure!( Self::underlying_id(market.lend_token_id)? == asset_id,