mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 10:31:03 +00:00
Fix reset curator deposit when curator unassigns themself. (#10443)
This commit is contained in:
@@ -453,6 +453,7 @@ pub mod pallet {
|
||||
let err_amount =
|
||||
T::Currency::unreserve(&curator, bounty.curator_deposit);
|
||||
debug_assert!(err_amount.is_zero());
|
||||
bounty.curator_deposit = Zero::zero();
|
||||
// Continue to change bounty status below...
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1004,3 +1004,42 @@ fn genesis_funding_works() {
|
||||
assert_eq!(Treasury::pot(), initial_funding - Balances::minimum_balance());
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unassign_curator_self() {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::set_block_number(1);
|
||||
Balances::make_free_balance_be(&Treasury::account_id(), 101);
|
||||
assert_ok!(Bounties::propose_bounty(Origin::signed(0), 50, b"12345".to_vec()));
|
||||
assert_ok!(Bounties::approve_bounty(Origin::root(), 0));
|
||||
|
||||
System::set_block_number(2);
|
||||
<Treasury as OnInitialize<u64>>::on_initialize(2);
|
||||
|
||||
assert_ok!(Bounties::propose_curator(Origin::root(), 0, 1, 10));
|
||||
assert_ok!(Bounties::accept_curator(Origin::signed(1), 0));
|
||||
|
||||
assert_eq!(Balances::free_balance(1), 93);
|
||||
assert_eq!(Balances::reserved_balance(1), 5);
|
||||
|
||||
System::set_block_number(8);
|
||||
<Treasury as OnInitialize<u64>>::on_initialize(8);
|
||||
|
||||
assert_ok!(Bounties::unassign_curator(Origin::signed(1), 0));
|
||||
|
||||
assert_eq!(
|
||||
Bounties::bounties(0).unwrap(),
|
||||
Bounty {
|
||||
proposer: 0,
|
||||
fee: 10,
|
||||
curator_deposit: 0,
|
||||
value: 50,
|
||||
bond: 85,
|
||||
status: BountyStatus::Funded,
|
||||
}
|
||||
);
|
||||
|
||||
assert_eq!(Balances::free_balance(1), 98);
|
||||
assert_eq!(Balances::reserved_balance(1), 0); // not slashed
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user