fix: request_redeem: don't require vault to have  available
@@ -243,19 +243,19 @@ impl<T: Config> Module<T> {
Error::<T>::AmountExceedsUserBalance
);
+ let fee_polka_btc = ext::fee::get_redeem_fee::<T>(amount_polka_btc)?;
+ let redeem_amount_polka_btc = amount_polka_btc
+ .checked_sub(&fee_polka_btc)
+ .ok_or(Error::<T>::ArithmeticUnderflow)?;
+
let vault = ext::vault_registry::get_active_vault_from_id::<T>(&vault_id)?;
let height = <frame_system::Module<T>>::block_number();
ext::vault_registry::ensure_not_banned::<T>(&vault_id, height)?;
ensure!(
- amount_polka_btc <= vault.issued_tokens,
+ redeem_amount_polka_btc <= vault.issued_tokens,
Error::<T>::AmountExceedsVaultBalance
);
- let fee_polka_btc = ext::fee::get_redeem_fee::<T>(amount_polka_btc)?;
- let redeem_amount_polka_btc = amount_polka_btc
- .checked_sub(&fee_polka_btc)
- .ok_or(Error::<T>::ArithmeticUnderflow)?;
-
// only allow requests of amount above above the minimum
let dust_value = <RedeemBtcDustValue<T>>::get();
ensure!(
