@@ -614,26 +614,13 @@ impl<T: Config> Pallet<T> {
614614 ext:: fee:: get_redeem_fee :: < T > ( & amount_wrapped) ?
615615 } ;
616616
617- // only allow requests of amount above above the minimum
618- ensure ! (
619- // this is the amount the vault will send
620- amount_wrapped. ge( & Self :: get_dust_value( vault_id. wrapped_currency( ) ) ) ?,
621- Error :: <T >:: AmountBelowDustAmount
622- ) ;
623-
624- // increased the to_be_redeem tokens by amount_wrapped - fee_wrapped
625- ext:: vault_registry:: try_increase_to_be_redeemed_tokens :: < T > (
626- & vault_id,
627- & amount_wrapped. checked_sub ( & fee_wrapped) ?,
628- ) ?;
629-
630617 (
631618 fee_wrapped,
632619 // the inclusion fee is paid by old vault itself hence we can set it as zero
633620 Amount :: zero ( vault_id. wrapped_currency ( ) ) ,
634621 // the new vault (redeemer) should receive the whole amount without deduction of fees
635622 // as fee handling is done by old vault itself
636- amount_wrapped,
623+ amount_wrapped. clone ( ) ,
637624 )
638625 } else {
639626 let redeemer_balance =
@@ -657,20 +644,24 @@ impl<T: Config> Pallet<T> {
657644 . checked_sub ( & inclusion_fee)
658645 . map_err ( |_| Error :: < T > :: AmountBelowDustAmount ) ?;
659646
660- // only allow requests of amount above above the minimum
661- ensure ! (
662- // this is the amount the vault will send (minus fee)
663- user_to_be_received_btc. ge( & Self :: get_dust_value( vault_id. wrapped_currency( ) ) ) ?,
664- Error :: <T >:: AmountBelowDustAmount
665- ) ;
666-
667- // vault will get rid of the btc + btc_inclusion_fee
668- ext:: vault_registry:: try_increase_to_be_redeemed_tokens :: < T > ( & vault_id, & vault_to_be_burned_tokens) ?;
669647 amount_wrapped. lock_on ( redeemer. get_account ( ) ) ?;
670648
671649 ( fee_wrapped, inclusion_fee, user_to_be_received_btc)
672650 } ;
673651
652+ // only allow requests of amount above above the minimum
653+ ensure ! (
654+ // this is the amount the vault will send
655+ user_to_be_received_btc. ge( & Self :: get_dust_value( vault_id. wrapped_currency( ) ) ) ?,
656+ Error :: <T >:: AmountBelowDustAmount
657+ ) ;
658+
659+ // increased the to_be_redeem tokens by amount_wrapped - fee_wrapped
660+ ext:: vault_registry:: try_increase_to_be_redeemed_tokens :: < T > (
661+ & vault_id,
662+ & amount_wrapped. checked_sub ( & fee_wrapped) ?,
663+ ) ?;
664+
674665 let redeem_id = ext:: security:: get_secure_id :: < T > ( redeemer. get_account ( ) ) ;
675666
676667 let below_premium_redeem = ext:: vault_registry:: is_vault_below_premium_threshold :: < T > ( & vault_id) ?;
0 commit comments