From 386737953deb793ddd57607ddc11adfc5e06e926 Mon Sep 17 00:00:00 2001 From: nakul1010 Date: Mon, 1 Jan 2024 10:49:15 +0530 Subject: [PATCH] fix: code comments --- crates/vault-registry/src/lib.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/crates/vault-registry/src/lib.rs b/crates/vault-registry/src/lib.rs index 6d749510ca..c89e03ad51 100644 --- a/crates/vault-registry/src/lib.rs +++ b/crates/vault-registry/src/lib.rs @@ -1706,9 +1706,12 @@ impl Pallet { let request_redeem_tokens_for_max_premium = vault_to_burn_tokens.checked_div(&amount_wrapped).ok()?; - if Self::ensure_not_banned(&vault_id).is_ok() && !request_redeem_tokens_for_max_premium.is_zero() - // need `will_be_below_premium_threshold` check as `inclusion_fee` will be a non zero amount, hence `request_redeem_tokens_for_max_premium` will also be a non zero amount - && Self::will_be_below_premium_threshold(&vault_id).unwrap_or(false) + if Self::ensure_not_banned(&vault_id).is_ok() + && !request_redeem_tokens_for_max_premium.is_zero() + // Need to check `will_be_below_premium_threshold` to handle a corner case + // where the vault is above PremiumThreshold, but `request_redeem_tokens_for_max_premium` is being calculated as a non-zero amount + // since the `inclusion_fee` is a non-zero amount. + && Self::will_be_below_premium_threshold(&vault_id).unwrap_or(false) { Some((vault_id, request_redeem_tokens_for_max_premium)) } else {