From d707c68f21f27b0ee7f3d0b9aa7f6ef36b601cf7 Mon Sep 17 00:00:00 2001 From: Mokhtar Naamani Date: Mon, 8 Jan 2024 17:13:38 +0400 Subject: [PATCH] project-token pallet: disable buy/sell_on_amm when pallet is frozen --- runtime-modules/project-token/src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/runtime-modules/project-token/src/lib.rs b/runtime-modules/project-token/src/lib.rs index 960ea3a284..5fba7a5ab3 100644 --- a/runtime-modules/project-token/src/lib.rs +++ b/runtime-modules/project-token/src/lib.rs @@ -836,6 +836,8 @@ decl_module! { /// - event deposited #[weight = WeightInfoToken::::buy_on_amm_with_existing_account()] fn buy_on_amm(origin, token_id: T::TokenId, member_id: T::MemberId, amount: ::Balance, slippage_tolerance: Option<(Permill, JoyBalanceOf)>) -> DispatchResult { + Self::ensure_unfrozen_state()?; + if amount.is_zero() { return Ok(()); // noop } @@ -916,6 +918,8 @@ decl_module! { /// - event deposited #[weight = WeightInfoToken::::sell_on_amm()] fn sell_on_amm(origin, token_id: T::TokenId, member_id: T::MemberId, amount: ::Balance, slippage_tolerance: Option<(Permill, JoyBalanceOf)>) -> DispatchResult { + Self::ensure_unfrozen_state()?; + if amount.is_zero() { return Ok(()); // noop }