diff --git a/crates/redeem/src/ext.rs b/crates/redeem/src/ext.rs index 6e5f049f62..08650cef36 100644 --- a/crates/redeem/src/ext.rs +++ b/crates/redeem/src/ext.rs @@ -44,7 +44,9 @@ pub(crate) mod vault_registry { use frame_support::dispatch::{DispatchError, DispatchResult}; use vault_registry::types::{CurrencyId, CurrencySource, DefaultVault}; - pub fn max_premium_for_vault(vault_id: &DefaultVaultId) -> Result, DispatchError> { + pub fn get_vault_max_premium_redeem( + vault_id: &DefaultVaultId, + ) -> Result, DispatchError> { >::get_vault_max_premium_redeem(vault_id) } diff --git a/crates/redeem/src/lib.rs b/crates/redeem/src/lib.rs index 84e0826619..34f4568d84 100644 --- a/crates/redeem/src/lib.rs +++ b/crates/redeem/src/lib.rs @@ -506,12 +506,12 @@ impl Pallet { let currency_id = vault_id.collateral_currency(); let premium_collateral = if below_premium_redeem { - let premium_redeem_rate = ext::fee::premium_redeem_reward_rate::(); let redeem_amount_wrapped_in_collateral = user_to_be_received_btc.convert_to(currency_id)?; + let premium_redeem_rate = ext::fee::premium_redeem_reward_rate::(); let premium_for_redeem_amount = redeem_amount_wrapped_in_collateral .checked_rounded_mul(&premium_redeem_rate, Rounding::NearestPrefUp)?; - let max_premium = ext::vault_registry::max_premium_for_vault(&vault_id)?; + let max_premium = ext::vault_registry::get_vault_max_premium_redeem(&vault_id)?; max_premium.min(&premium_for_redeem_amount)? } else { Amount::zero(currency_id) diff --git a/crates/vault-registry/src/tests.rs b/crates/vault-registry/src/tests.rs index 4a9104bf71..bb1defa353 100644 --- a/crates/vault-registry/src/tests.rs +++ b/crates/vault-registry/src/tests.rs @@ -1071,7 +1071,7 @@ mod get_vaults_below_premium_collaterlization_tests { // set back to default threshold so that vaults fall under premium redeem set_default_thresholds(); - // not returned, because is is not under premium threshold + // not returned let id3 = vault_id(4); let issue_tokens2: u128 = 50; let collateral2 = 150;