Skip to content

Commit

Permalink
fix unbond_instant (#2735)
Browse files Browse the repository at this point in the history
  • Loading branch information
zjb0807 authored Apr 10, 2024
1 parent 63c9ef0 commit 1bead11
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion modules/earning/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ pub mod module {
T::Currency::withdraw(&who, fee, WithdrawReasons::TRANSFER, ExistenceRequirement::KeepAlive)?;
T::OnUnstakeFee::on_unbalanced(unbalance);

T::OnUnbonded::happened(&(who.clone(), final_amount));
// remove all shares of the change amount.
T::OnUnbonded::happened(&(who.clone(), amount));
Self::deposit_event(Event::InstantUnbonded {
who,
amount: final_amount,
Expand Down
2 changes: 1 addition & 1 deletion modules/earning/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ fn unbonding_works() {
}
.into(),
);
OnUnbonded::assert_eq_and_clear(vec![(ALICE, 900)]);
OnUnbonded::assert_eq_and_clear(vec![(ALICE, 1000)]);
OnUnstakeFee::assert_eq_and_clear(vec![100]);
// takes instant unbonding fee
assert_eq!(
Expand Down

0 comments on commit 1bead11

Please sign in to comment.