Add events for balance reserve and unreserve functions (#6330)

* almost works

* add clone to BalanceStatus

* reserve event

* fix staking tests

* fix balances tests

* Update frame/balances/src/tests.rs

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* restore tests and move event emission

* move repatriate reserved event outside of mutate_account

* clean up events in tests

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
joe petrowski
2020-06-12 15:24:46 +02:00
committed by GitHub
parent 7d3f1fe6ea
commit 252416d385
4 changed files with 71 additions and 12 deletions
+3 -3
View File
@@ -337,7 +337,7 @@ fn staking_should_work() {
claimed_rewards: vec![0],
})
);
// e.g. it cannot spend more than 500 that it has free from the total 2000
// e.g. it cannot reserve more than 500 that it has free from the total 2000
assert_noop!(
Balances::reserve(&3, 501),
BalancesError::<Test, _>::LiquidityRestrictions
@@ -783,10 +783,10 @@ fn cannot_reserve_staked_balance() {
assert_eq!(Balances::free_balance(11), 1000);
// Confirm account 11 (via controller 10) is totally staked
assert_eq!(Staking::eras_stakers(Staking::active_era().unwrap().index, 11).own, 1000);
// Confirm account 11 cannot transfer as a result
// Confirm account 11 cannot reserve as a result
assert_noop!(
Balances::reserve(&11, 1),
BalancesError::<Test, _>::LiquidityRestrictions
BalancesError::<Test, _>::LiquidityRestrictions,
);
// Give account 11 extra free balance