Skip to content

Commit

Permalink
fix: change function name
Browse files Browse the repository at this point in the history
  • Loading branch information
nakul1010 committed Dec 6, 2023
1 parent 6ee3591 commit 76ec7b9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion crates/redeem/src/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T: crate::Config>(vault_id: &DefaultVaultId<T>) -> Result<Amount<T>, DispatchError> {
pub fn get_vault_max_premium_redeem<T: crate::Config>(
vault_id: &DefaultVaultId<T>,
) -> Result<Amount<T>, DispatchError> {
<vault_registry::Pallet<T>>::get_vault_max_premium_redeem(vault_id)
}

Expand Down
4 changes: 2 additions & 2 deletions crates/redeem/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -506,12 +506,12 @@ impl<T: Config> Pallet<T> {
let currency_id = vault_id.collateral_currency();

let premium_collateral = if below_premium_redeem {
let premium_redeem_rate = ext::fee::premium_redeem_reward_rate::<T>();
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::<T>();
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)
Expand Down
2 changes: 1 addition & 1 deletion crates/vault-registry/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 76ec7b9

Please sign in to comment.