mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 00:01:03 +00:00
BREAKING: Rename Origin (#12258)
* BREAKING: Rename Origin * more renaming * a bit more renaming * fix * more fixing * fix in frame_support * even more fixes * fix * small fix * ... * update .stderr * docs * update docs * update docs * docs
This commit is contained in:
@@ -71,7 +71,7 @@ impl frame_system::Config for Test {
|
||||
type BlockWeights = ();
|
||||
type BlockLength = ();
|
||||
type DbWeight = ();
|
||||
type Origin = Origin;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type Index = u64;
|
||||
type BlockNumber = u64;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
@@ -211,19 +211,19 @@ fn add_child_bounty() {
|
||||
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::propose_bounty(RuntimeOrigin::signed(0), 50, b"12345".to_vec()));
|
||||
|
||||
assert_ok!(Bounties::approve_bounty(Origin::root(), 0));
|
||||
assert_ok!(Bounties::approve_bounty(RuntimeOrigin::root(), 0));
|
||||
|
||||
System::set_block_number(2);
|
||||
<Treasury as OnInitialize<u64>>::on_initialize(2);
|
||||
|
||||
let fee = 8;
|
||||
assert_ok!(Bounties::propose_curator(Origin::root(), 0, 4, fee));
|
||||
assert_ok!(Bounties::propose_curator(RuntimeOrigin::root(), 0, 4, fee));
|
||||
|
||||
Balances::make_free_balance_be(&4, 10);
|
||||
|
||||
assert_ok!(Bounties::accept_curator(Origin::signed(4), 0));
|
||||
assert_ok!(Bounties::accept_curator(RuntimeOrigin::signed(4), 0));
|
||||
|
||||
// This verifies that the accept curator logic took a deposit.
|
||||
let expected_deposit = CuratorDepositMultiplier::get() * fee;
|
||||
@@ -234,7 +234,7 @@ fn add_child_bounty() {
|
||||
// Acc-4 is the parent curator.
|
||||
// Call from invalid origin & check for error "RequireCurator".
|
||||
assert_noop!(
|
||||
ChildBounties::add_child_bounty(Origin::signed(0), 0, 10, b"12345-p1".to_vec()),
|
||||
ChildBounties::add_child_bounty(RuntimeOrigin::signed(0), 0, 10, b"12345-p1".to_vec()),
|
||||
BountiesError::RequireCurator,
|
||||
);
|
||||
|
||||
@@ -246,17 +246,22 @@ fn add_child_bounty() {
|
||||
assert_eq!(Balances::reserved_balance(Bounties::bounty_account_id(0)), 0);
|
||||
|
||||
assert_noop!(
|
||||
ChildBounties::add_child_bounty(Origin::signed(4), 0, 50, b"12345-p1".to_vec()),
|
||||
ChildBounties::add_child_bounty(RuntimeOrigin::signed(4), 0, 50, b"12345-p1".to_vec()),
|
||||
pallet_balances::Error::<Test>::KeepAlive,
|
||||
);
|
||||
|
||||
assert_noop!(
|
||||
ChildBounties::add_child_bounty(Origin::signed(4), 0, 100, b"12345-p1".to_vec()),
|
||||
ChildBounties::add_child_bounty(RuntimeOrigin::signed(4), 0, 100, b"12345-p1".to_vec()),
|
||||
Error::<Test>::InsufficientBountyBalance,
|
||||
);
|
||||
|
||||
// Add child-bounty with valid value, which can be funded by parent bounty.
|
||||
assert_ok!(ChildBounties::add_child_bounty(Origin::signed(4), 0, 10, b"12345-p1".to_vec()));
|
||||
assert_ok!(ChildBounties::add_child_bounty(
|
||||
RuntimeOrigin::signed(4),
|
||||
0,
|
||||
10,
|
||||
b"12345-p1".to_vec()
|
||||
));
|
||||
|
||||
// Check for the event child-bounty added.
|
||||
assert_eq!(last_event(), ChildBountiesEvent::Added { index: 0, child_index: 0 });
|
||||
@@ -299,16 +304,16 @@ fn child_bounty_assign_curator() {
|
||||
Balances::make_free_balance_be(&4, 101);
|
||||
Balances::make_free_balance_be(&8, 101);
|
||||
|
||||
assert_ok!(Bounties::propose_bounty(Origin::signed(0), 50, b"12345".to_vec()));
|
||||
assert_ok!(Bounties::propose_bounty(RuntimeOrigin::signed(0), 50, b"12345".to_vec()));
|
||||
|
||||
assert_ok!(Bounties::approve_bounty(Origin::root(), 0));
|
||||
assert_ok!(Bounties::approve_bounty(RuntimeOrigin::root(), 0));
|
||||
|
||||
System::set_block_number(2);
|
||||
<Treasury as OnInitialize<u64>>::on_initialize(2);
|
||||
|
||||
let fee = 4;
|
||||
assert_ok!(Bounties::propose_curator(Origin::root(), 0, 4, fee));
|
||||
assert_ok!(Bounties::accept_curator(Origin::signed(4), 0));
|
||||
assert_ok!(Bounties::propose_curator(RuntimeOrigin::root(), 0, 4, fee));
|
||||
assert_ok!(Bounties::accept_curator(RuntimeOrigin::signed(4), 0));
|
||||
|
||||
// Bounty account status before adding child-bounty.
|
||||
assert_eq!(Balances::free_balance(Bounties::bounty_account_id(0)), 50);
|
||||
@@ -322,7 +327,12 @@ fn child_bounty_assign_curator() {
|
||||
|
||||
// Add child-bounty.
|
||||
// Acc-4 is the parent curator & make sure enough deposit.
|
||||
assert_ok!(ChildBounties::add_child_bounty(Origin::signed(4), 0, 10, b"12345-p1".to_vec()));
|
||||
assert_ok!(ChildBounties::add_child_bounty(
|
||||
RuntimeOrigin::signed(4),
|
||||
0,
|
||||
10,
|
||||
b"12345-p1".to_vec()
|
||||
));
|
||||
|
||||
assert_eq!(last_event(), ChildBountiesEvent::Added { index: 0, child_index: 0 });
|
||||
|
||||
@@ -335,7 +345,7 @@ fn child_bounty_assign_curator() {
|
||||
assert_eq!(Balances::reserved_balance(ChildBounties::child_bounty_account_id(0)), 0);
|
||||
|
||||
let fee = 6u64;
|
||||
assert_ok!(ChildBounties::propose_curator(Origin::signed(4), 0, 0, 8, fee));
|
||||
assert_ok!(ChildBounties::propose_curator(RuntimeOrigin::signed(4), 0, 0, 8, fee));
|
||||
|
||||
assert_eq!(
|
||||
ChildBounties::child_bounties(0, 0).unwrap(),
|
||||
@@ -353,11 +363,11 @@ fn child_bounty_assign_curator() {
|
||||
assert_eq!(Balances::reserved_balance(4), expected_deposit);
|
||||
|
||||
assert_noop!(
|
||||
ChildBounties::accept_curator(Origin::signed(3), 0, 0),
|
||||
ChildBounties::accept_curator(RuntimeOrigin::signed(3), 0, 0),
|
||||
BountiesError::RequireCurator,
|
||||
);
|
||||
|
||||
assert_ok!(ChildBounties::accept_curator(Origin::signed(8), 0, 0));
|
||||
assert_ok!(ChildBounties::accept_curator(RuntimeOrigin::signed(8), 0, 0));
|
||||
|
||||
let expected_child_deposit = CuratorDepositMultiplier::get() * fee;
|
||||
|
||||
@@ -403,34 +413,39 @@ fn award_claim_child_bounty() {
|
||||
Balances::make_free_balance_be(&4, 101); // Parent-bounty curator.
|
||||
Balances::make_free_balance_be(&8, 101); // Child-bounty curator.
|
||||
|
||||
assert_ok!(Bounties::propose_bounty(Origin::signed(0), 50, b"12345".to_vec()));
|
||||
assert_ok!(Bounties::propose_bounty(RuntimeOrigin::signed(0), 50, b"12345".to_vec()));
|
||||
|
||||
assert_ok!(Bounties::approve_bounty(Origin::root(), 0));
|
||||
assert_ok!(Bounties::approve_bounty(RuntimeOrigin::root(), 0));
|
||||
|
||||
System::set_block_number(2);
|
||||
<Treasury as OnInitialize<u64>>::on_initialize(2);
|
||||
|
||||
assert_ok!(Bounties::propose_curator(Origin::root(), 0, 4, 6));
|
||||
assert_ok!(Bounties::accept_curator(Origin::signed(4), 0));
|
||||
assert_ok!(Bounties::propose_curator(RuntimeOrigin::root(), 0, 4, 6));
|
||||
assert_ok!(Bounties::accept_curator(RuntimeOrigin::signed(4), 0));
|
||||
|
||||
// Child-bounty.
|
||||
assert_ok!(ChildBounties::add_child_bounty(Origin::signed(4), 0, 10, b"12345-p1".to_vec()));
|
||||
assert_ok!(ChildBounties::add_child_bounty(
|
||||
RuntimeOrigin::signed(4),
|
||||
0,
|
||||
10,
|
||||
b"12345-p1".to_vec()
|
||||
));
|
||||
|
||||
assert_eq!(last_event(), ChildBountiesEvent::Added { index: 0, child_index: 0 });
|
||||
|
||||
// Propose and accept curator for child-bounty.
|
||||
let fee = 8;
|
||||
assert_ok!(ChildBounties::propose_curator(Origin::signed(4), 0, 0, 8, fee));
|
||||
assert_ok!(ChildBounties::accept_curator(Origin::signed(8), 0, 0));
|
||||
assert_ok!(ChildBounties::propose_curator(RuntimeOrigin::signed(4), 0, 0, 8, fee));
|
||||
assert_ok!(ChildBounties::accept_curator(RuntimeOrigin::signed(8), 0, 0));
|
||||
|
||||
// Award child-bounty.
|
||||
// Test for non child-bounty curator.
|
||||
assert_noop!(
|
||||
ChildBounties::award_child_bounty(Origin::signed(3), 0, 0, 7),
|
||||
ChildBounties::award_child_bounty(RuntimeOrigin::signed(3), 0, 0, 7),
|
||||
BountiesError::RequireCurator,
|
||||
);
|
||||
|
||||
assert_ok!(ChildBounties::award_child_bounty(Origin::signed(8), 0, 0, 7));
|
||||
assert_ok!(ChildBounties::award_child_bounty(RuntimeOrigin::signed(8), 0, 0, 7));
|
||||
|
||||
let expected_deposit = CuratorDepositMultiplier::get() * fee;
|
||||
assert_eq!(
|
||||
@@ -451,13 +466,13 @@ fn award_claim_child_bounty() {
|
||||
// Claim child-bounty.
|
||||
// Test for Premature condition.
|
||||
assert_noop!(
|
||||
ChildBounties::claim_child_bounty(Origin::signed(7), 0, 0),
|
||||
ChildBounties::claim_child_bounty(RuntimeOrigin::signed(7), 0, 0),
|
||||
BountiesError::Premature
|
||||
);
|
||||
|
||||
System::set_block_number(9);
|
||||
|
||||
assert_ok!(ChildBounties::claim_child_bounty(Origin::signed(7), 0, 0));
|
||||
assert_ok!(ChildBounties::claim_child_bounty(RuntimeOrigin::signed(7), 0, 0));
|
||||
|
||||
// Ensure child-bounty curator is paid with curator fee & deposit refund.
|
||||
assert_eq!(Balances::free_balance(8), 101 + fee);
|
||||
@@ -489,19 +504,24 @@ fn close_child_bounty_added() {
|
||||
Balances::make_free_balance_be(&4, 101); // Parent-bounty curator.
|
||||
Balances::make_free_balance_be(&8, 101); // Child-bounty curator.
|
||||
|
||||
assert_ok!(Bounties::propose_bounty(Origin::signed(0), 50, b"12345".to_vec()));
|
||||
assert_ok!(Bounties::propose_bounty(RuntimeOrigin::signed(0), 50, b"12345".to_vec()));
|
||||
|
||||
assert_ok!(Bounties::approve_bounty(Origin::root(), 0));
|
||||
assert_ok!(Bounties::approve_bounty(RuntimeOrigin::root(), 0));
|
||||
|
||||
System::set_block_number(2);
|
||||
<Treasury as OnInitialize<u64>>::on_initialize(2);
|
||||
|
||||
assert_ok!(Bounties::propose_curator(Origin::root(), 0, 4, 6));
|
||||
assert_ok!(Bounties::propose_curator(RuntimeOrigin::root(), 0, 4, 6));
|
||||
|
||||
assert_ok!(Bounties::accept_curator(Origin::signed(4), 0));
|
||||
assert_ok!(Bounties::accept_curator(RuntimeOrigin::signed(4), 0));
|
||||
|
||||
// Child-bounty.
|
||||
assert_ok!(ChildBounties::add_child_bounty(Origin::signed(4), 0, 10, b"12345-p1".to_vec()));
|
||||
assert_ok!(ChildBounties::add_child_bounty(
|
||||
RuntimeOrigin::signed(4),
|
||||
0,
|
||||
10,
|
||||
b"12345-p1".to_vec()
|
||||
));
|
||||
|
||||
assert_eq!(last_event(), ChildBountiesEvent::Added { index: 0, child_index: 0 });
|
||||
|
||||
@@ -509,11 +529,11 @@ fn close_child_bounty_added() {
|
||||
|
||||
// Close child-bounty.
|
||||
// Wrong origin.
|
||||
assert_noop!(ChildBounties::close_child_bounty(Origin::signed(7), 0, 0), BadOrigin);
|
||||
assert_noop!(ChildBounties::close_child_bounty(Origin::signed(8), 0, 0), BadOrigin);
|
||||
assert_noop!(ChildBounties::close_child_bounty(RuntimeOrigin::signed(7), 0, 0), BadOrigin);
|
||||
assert_noop!(ChildBounties::close_child_bounty(RuntimeOrigin::signed(8), 0, 0), BadOrigin);
|
||||
|
||||
// Correct origin - parent curator.
|
||||
assert_ok!(ChildBounties::close_child_bounty(Origin::signed(4), 0, 0));
|
||||
assert_ok!(ChildBounties::close_child_bounty(RuntimeOrigin::signed(4), 0, 0));
|
||||
|
||||
// Check the child-bounty count.
|
||||
assert_eq!(ChildBounties::parent_child_bounties(0), 0);
|
||||
@@ -541,28 +561,33 @@ fn close_child_bounty_active() {
|
||||
Balances::make_free_balance_be(&4, 101); // Parent-bounty curator.
|
||||
Balances::make_free_balance_be(&8, 101); // Child-bounty curator.
|
||||
|
||||
assert_ok!(Bounties::propose_bounty(Origin::signed(0), 50, b"12345".to_vec()));
|
||||
assert_ok!(Bounties::propose_bounty(RuntimeOrigin::signed(0), 50, b"12345".to_vec()));
|
||||
|
||||
assert_ok!(Bounties::approve_bounty(Origin::root(), 0));
|
||||
assert_ok!(Bounties::approve_bounty(RuntimeOrigin::root(), 0));
|
||||
|
||||
System::set_block_number(2);
|
||||
<Treasury as OnInitialize<u64>>::on_initialize(2);
|
||||
|
||||
assert_ok!(Bounties::propose_curator(Origin::root(), 0, 4, 6));
|
||||
assert_ok!(Bounties::propose_curator(RuntimeOrigin::root(), 0, 4, 6));
|
||||
|
||||
assert_ok!(Bounties::accept_curator(Origin::signed(4), 0));
|
||||
assert_ok!(Bounties::accept_curator(RuntimeOrigin::signed(4), 0));
|
||||
|
||||
// Child-bounty.
|
||||
assert_ok!(ChildBounties::add_child_bounty(Origin::signed(4), 0, 10, b"12345-p1".to_vec()));
|
||||
assert_ok!(ChildBounties::add_child_bounty(
|
||||
RuntimeOrigin::signed(4),
|
||||
0,
|
||||
10,
|
||||
b"12345-p1".to_vec()
|
||||
));
|
||||
|
||||
assert_eq!(last_event(), ChildBountiesEvent::Added { index: 0, child_index: 0 });
|
||||
|
||||
// Propose and accept curator for child-bounty.
|
||||
assert_ok!(ChildBounties::propose_curator(Origin::signed(4), 0, 0, 8, 2));
|
||||
assert_ok!(ChildBounties::accept_curator(Origin::signed(8), 0, 0));
|
||||
assert_ok!(ChildBounties::propose_curator(RuntimeOrigin::signed(4), 0, 0, 8, 2));
|
||||
assert_ok!(ChildBounties::accept_curator(RuntimeOrigin::signed(8), 0, 0));
|
||||
|
||||
// Close child-bounty in active state.
|
||||
assert_ok!(ChildBounties::close_child_bounty(Origin::signed(4), 0, 0));
|
||||
assert_ok!(ChildBounties::close_child_bounty(RuntimeOrigin::signed(4), 0, 0));
|
||||
|
||||
// Check the child-bounty count.
|
||||
assert_eq!(ChildBounties::parent_child_bounties(0), 0);
|
||||
@@ -594,33 +619,38 @@ fn close_child_bounty_pending() {
|
||||
Balances::make_free_balance_be(&4, 101); // Parent-bounty curator.
|
||||
Balances::make_free_balance_be(&8, 101); // Child-bounty curator.
|
||||
|
||||
assert_ok!(Bounties::propose_bounty(Origin::signed(0), 50, b"12345".to_vec()));
|
||||
assert_ok!(Bounties::propose_bounty(RuntimeOrigin::signed(0), 50, b"12345".to_vec()));
|
||||
|
||||
assert_ok!(Bounties::approve_bounty(Origin::root(), 0));
|
||||
assert_ok!(Bounties::approve_bounty(RuntimeOrigin::root(), 0));
|
||||
|
||||
System::set_block_number(2);
|
||||
<Treasury as OnInitialize<u64>>::on_initialize(2);
|
||||
|
||||
let parent_fee = 6;
|
||||
assert_ok!(Bounties::propose_curator(Origin::root(), 0, 4, parent_fee));
|
||||
assert_ok!(Bounties::accept_curator(Origin::signed(4), 0));
|
||||
assert_ok!(Bounties::propose_curator(RuntimeOrigin::root(), 0, 4, parent_fee));
|
||||
assert_ok!(Bounties::accept_curator(RuntimeOrigin::signed(4), 0));
|
||||
|
||||
// Child-bounty.
|
||||
assert_ok!(ChildBounties::add_child_bounty(Origin::signed(4), 0, 10, b"12345-p1".to_vec()));
|
||||
assert_ok!(ChildBounties::add_child_bounty(
|
||||
RuntimeOrigin::signed(4),
|
||||
0,
|
||||
10,
|
||||
b"12345-p1".to_vec()
|
||||
));
|
||||
|
||||
assert_eq!(last_event(), ChildBountiesEvent::Added { index: 0, child_index: 0 });
|
||||
|
||||
// Propose and accept curator for child-bounty.
|
||||
let child_fee = 4;
|
||||
assert_ok!(ChildBounties::propose_curator(Origin::signed(4), 0, 0, 8, child_fee));
|
||||
assert_ok!(ChildBounties::accept_curator(Origin::signed(8), 0, 0));
|
||||
assert_ok!(ChildBounties::propose_curator(RuntimeOrigin::signed(4), 0, 0, 8, child_fee));
|
||||
assert_ok!(ChildBounties::accept_curator(RuntimeOrigin::signed(8), 0, 0));
|
||||
let expected_child_deposit = CuratorDepositMin::get();
|
||||
|
||||
assert_ok!(ChildBounties::award_child_bounty(Origin::signed(8), 0, 0, 7));
|
||||
assert_ok!(ChildBounties::award_child_bounty(RuntimeOrigin::signed(8), 0, 0, 7));
|
||||
|
||||
// Close child-bounty in pending_payout state.
|
||||
assert_noop!(
|
||||
ChildBounties::close_child_bounty(Origin::signed(4), 0, 0),
|
||||
ChildBounties::close_child_bounty(RuntimeOrigin::signed(4), 0, 0),
|
||||
BountiesError::PendingPayout
|
||||
);
|
||||
|
||||
@@ -650,25 +680,30 @@ fn child_bounty_added_unassign_curator() {
|
||||
Balances::make_free_balance_be(&4, 101); // Parent-bounty curator.
|
||||
Balances::make_free_balance_be(&8, 101); // Child-bounty curator.
|
||||
|
||||
assert_ok!(Bounties::propose_bounty(Origin::signed(0), 50, b"12345".to_vec()));
|
||||
assert_ok!(Bounties::propose_bounty(RuntimeOrigin::signed(0), 50, b"12345".to_vec()));
|
||||
|
||||
assert_ok!(Bounties::approve_bounty(Origin::root(), 0));
|
||||
assert_ok!(Bounties::approve_bounty(RuntimeOrigin::root(), 0));
|
||||
|
||||
System::set_block_number(2);
|
||||
<Treasury as OnInitialize<u64>>::on_initialize(2);
|
||||
|
||||
assert_ok!(Bounties::propose_curator(Origin::root(), 0, 4, 6));
|
||||
assert_ok!(Bounties::propose_curator(RuntimeOrigin::root(), 0, 4, 6));
|
||||
|
||||
assert_ok!(Bounties::accept_curator(Origin::signed(4), 0));
|
||||
assert_ok!(Bounties::accept_curator(RuntimeOrigin::signed(4), 0));
|
||||
|
||||
// Child-bounty.
|
||||
assert_ok!(ChildBounties::add_child_bounty(Origin::signed(4), 0, 10, b"12345-p1".to_vec()));
|
||||
assert_ok!(ChildBounties::add_child_bounty(
|
||||
RuntimeOrigin::signed(4),
|
||||
0,
|
||||
10,
|
||||
b"12345-p1".to_vec()
|
||||
));
|
||||
|
||||
assert_eq!(last_event(), ChildBountiesEvent::Added { index: 0, child_index: 0 });
|
||||
|
||||
// Unassign curator in added state.
|
||||
assert_noop!(
|
||||
ChildBounties::unassign_curator(Origin::signed(4), 0, 0),
|
||||
ChildBounties::unassign_curator(RuntimeOrigin::signed(4), 0, 0),
|
||||
BountiesError::UnexpectedStatus
|
||||
);
|
||||
});
|
||||
@@ -687,24 +722,29 @@ fn child_bounty_curator_proposed_unassign_curator() {
|
||||
Balances::make_free_balance_be(&4, 101); // Parent-bounty curator.
|
||||
Balances::make_free_balance_be(&8, 101); // Child-bounty curator.
|
||||
|
||||
assert_ok!(Bounties::propose_bounty(Origin::signed(0), 50, b"12345".to_vec()));
|
||||
assert_ok!(Bounties::propose_bounty(RuntimeOrigin::signed(0), 50, b"12345".to_vec()));
|
||||
|
||||
assert_ok!(Bounties::approve_bounty(Origin::root(), 0));
|
||||
assert_ok!(Bounties::approve_bounty(RuntimeOrigin::root(), 0));
|
||||
|
||||
System::set_block_number(2);
|
||||
<Treasury as OnInitialize<u64>>::on_initialize(2);
|
||||
|
||||
assert_ok!(Bounties::propose_curator(Origin::root(), 0, 4, 6));
|
||||
assert_ok!(Bounties::propose_curator(RuntimeOrigin::root(), 0, 4, 6));
|
||||
|
||||
assert_ok!(Bounties::accept_curator(Origin::signed(4), 0));
|
||||
assert_ok!(Bounties::accept_curator(RuntimeOrigin::signed(4), 0));
|
||||
|
||||
// Child-bounty.
|
||||
assert_ok!(ChildBounties::add_child_bounty(Origin::signed(4), 0, 10, b"12345-p1".to_vec()));
|
||||
assert_ok!(ChildBounties::add_child_bounty(
|
||||
RuntimeOrigin::signed(4),
|
||||
0,
|
||||
10,
|
||||
b"12345-p1".to_vec()
|
||||
));
|
||||
|
||||
assert_eq!(last_event(), ChildBountiesEvent::Added { index: 0, child_index: 0 });
|
||||
|
||||
// Propose curator for child-bounty.
|
||||
assert_ok!(ChildBounties::propose_curator(Origin::signed(4), 0, 0, 8, 2));
|
||||
assert_ok!(ChildBounties::propose_curator(RuntimeOrigin::signed(4), 0, 0, 8, 2));
|
||||
|
||||
assert_eq!(
|
||||
ChildBounties::child_bounties(0, 0).unwrap(),
|
||||
@@ -718,10 +758,10 @@ fn child_bounty_curator_proposed_unassign_curator() {
|
||||
);
|
||||
|
||||
// Random account cannot unassign the curator when in proposed state.
|
||||
assert_noop!(ChildBounties::unassign_curator(Origin::signed(99), 0, 0), BadOrigin);
|
||||
assert_noop!(ChildBounties::unassign_curator(RuntimeOrigin::signed(99), 0, 0), BadOrigin);
|
||||
|
||||
// Unassign curator.
|
||||
assert_ok!(ChildBounties::unassign_curator(Origin::signed(4), 0, 0));
|
||||
assert_ok!(ChildBounties::unassign_curator(RuntimeOrigin::signed(4), 0, 0));
|
||||
|
||||
// Verify updated child-bounty status.
|
||||
assert_eq!(
|
||||
@@ -759,18 +799,23 @@ fn child_bounty_active_unassign_curator() {
|
||||
Balances::make_free_balance_be(&7, 101); // Child-bounty curator 2.
|
||||
Balances::make_free_balance_be(&8, 101); // Child-bounty curator 3.
|
||||
|
||||
assert_ok!(Bounties::propose_bounty(Origin::signed(0), 50, b"12345".to_vec()));
|
||||
assert_ok!(Bounties::propose_bounty(RuntimeOrigin::signed(0), 50, b"12345".to_vec()));
|
||||
|
||||
assert_ok!(Bounties::approve_bounty(Origin::root(), 0));
|
||||
assert_ok!(Bounties::approve_bounty(RuntimeOrigin::root(), 0));
|
||||
|
||||
System::set_block_number(2);
|
||||
<Treasury as OnInitialize<u64>>::on_initialize(2);
|
||||
|
||||
assert_ok!(Bounties::propose_curator(Origin::root(), 0, 4, 6));
|
||||
assert_ok!(Bounties::accept_curator(Origin::signed(4), 0));
|
||||
assert_ok!(Bounties::propose_curator(RuntimeOrigin::root(), 0, 4, 6));
|
||||
assert_ok!(Bounties::accept_curator(RuntimeOrigin::signed(4), 0));
|
||||
|
||||
// Create Child-bounty.
|
||||
assert_ok!(ChildBounties::add_child_bounty(Origin::signed(4), 0, 10, b"12345-p1".to_vec()));
|
||||
assert_ok!(ChildBounties::add_child_bounty(
|
||||
RuntimeOrigin::signed(4),
|
||||
0,
|
||||
10,
|
||||
b"12345-p1".to_vec()
|
||||
));
|
||||
assert_eq!(last_event(), ChildBountiesEvent::Added { index: 0, child_index: 0 });
|
||||
|
||||
System::set_block_number(3);
|
||||
@@ -778,8 +823,8 @@ fn child_bounty_active_unassign_curator() {
|
||||
|
||||
// Propose and accept curator for child-bounty.
|
||||
let fee = 6;
|
||||
assert_ok!(ChildBounties::propose_curator(Origin::signed(4), 0, 0, 8, fee));
|
||||
assert_ok!(ChildBounties::accept_curator(Origin::signed(8), 0, 0));
|
||||
assert_ok!(ChildBounties::propose_curator(RuntimeOrigin::signed(4), 0, 0, 8, fee));
|
||||
assert_ok!(ChildBounties::accept_curator(RuntimeOrigin::signed(8), 0, 0));
|
||||
let expected_child_deposit = CuratorDepositMultiplier::get() * fee;
|
||||
|
||||
assert_eq!(
|
||||
@@ -797,7 +842,7 @@ fn child_bounty_active_unassign_curator() {
|
||||
<Treasury as OnInitialize<u64>>::on_initialize(4);
|
||||
|
||||
// Unassign curator - from reject origin.
|
||||
assert_ok!(ChildBounties::unassign_curator(Origin::root(), 0, 0));
|
||||
assert_ok!(ChildBounties::unassign_curator(RuntimeOrigin::root(), 0, 0));
|
||||
|
||||
// Verify updated child-bounty status.
|
||||
assert_eq!(
|
||||
@@ -817,8 +862,8 @@ fn child_bounty_active_unassign_curator() {
|
||||
|
||||
// Propose and accept curator for child-bounty again.
|
||||
let fee = 2;
|
||||
assert_ok!(ChildBounties::propose_curator(Origin::signed(4), 0, 0, 7, fee));
|
||||
assert_ok!(ChildBounties::accept_curator(Origin::signed(7), 0, 0));
|
||||
assert_ok!(ChildBounties::propose_curator(RuntimeOrigin::signed(4), 0, 0, 7, fee));
|
||||
assert_ok!(ChildBounties::accept_curator(RuntimeOrigin::signed(7), 0, 0));
|
||||
let expected_child_deposit = CuratorDepositMin::get();
|
||||
|
||||
assert_eq!(
|
||||
@@ -836,7 +881,7 @@ fn child_bounty_active_unassign_curator() {
|
||||
<Treasury as OnInitialize<u64>>::on_initialize(5);
|
||||
|
||||
// Unassign curator again - from parent curator.
|
||||
assert_ok!(ChildBounties::unassign_curator(Origin::signed(4), 0, 0));
|
||||
assert_ok!(ChildBounties::unassign_curator(RuntimeOrigin::signed(4), 0, 0));
|
||||
|
||||
// Verify updated child-bounty status.
|
||||
assert_eq!(
|
||||
@@ -855,8 +900,8 @@ fn child_bounty_active_unassign_curator() {
|
||||
assert_eq!(Balances::reserved_balance(7), 0); // slashed
|
||||
|
||||
// Propose and accept curator for child-bounty again.
|
||||
assert_ok!(ChildBounties::propose_curator(Origin::signed(4), 0, 0, 6, 2));
|
||||
assert_ok!(ChildBounties::accept_curator(Origin::signed(6), 0, 0));
|
||||
assert_ok!(ChildBounties::propose_curator(RuntimeOrigin::signed(4), 0, 0, 6, 2));
|
||||
assert_ok!(ChildBounties::accept_curator(RuntimeOrigin::signed(6), 0, 0));
|
||||
|
||||
assert_eq!(
|
||||
ChildBounties::child_bounties(0, 0).unwrap(),
|
||||
@@ -873,7 +918,7 @@ fn child_bounty_active_unassign_curator() {
|
||||
<Treasury as OnInitialize<u64>>::on_initialize(6);
|
||||
|
||||
// Unassign curator again - from child-bounty curator.
|
||||
assert_ok!(ChildBounties::unassign_curator(Origin::signed(6), 0, 0));
|
||||
assert_ok!(ChildBounties::unassign_curator(RuntimeOrigin::signed(6), 0, 0));
|
||||
|
||||
// Verify updated child-bounty status.
|
||||
assert_eq!(
|
||||
@@ -893,8 +938,8 @@ fn child_bounty_active_unassign_curator() {
|
||||
|
||||
// Propose and accept curator for child-bounty one last time.
|
||||
let fee = 2;
|
||||
assert_ok!(ChildBounties::propose_curator(Origin::signed(4), 0, 0, 6, fee));
|
||||
assert_ok!(ChildBounties::accept_curator(Origin::signed(6), 0, 0));
|
||||
assert_ok!(ChildBounties::propose_curator(RuntimeOrigin::signed(4), 0, 0, 6, fee));
|
||||
assert_ok!(ChildBounties::accept_curator(RuntimeOrigin::signed(6), 0, 0));
|
||||
let expected_child_deposit = CuratorDepositMin::get();
|
||||
|
||||
assert_eq!(
|
||||
@@ -914,7 +959,7 @@ fn child_bounty_active_unassign_curator() {
|
||||
// Unassign curator again - from non curator; non reject origin; some random guy.
|
||||
// Bounty update period is not yet complete.
|
||||
assert_noop!(
|
||||
ChildBounties::unassign_curator(Origin::signed(3), 0, 0),
|
||||
ChildBounties::unassign_curator(RuntimeOrigin::signed(3), 0, 0),
|
||||
BountiesError::Premature
|
||||
);
|
||||
|
||||
@@ -922,7 +967,7 @@ fn child_bounty_active_unassign_curator() {
|
||||
<Treasury as OnInitialize<u64>>::on_initialize(20);
|
||||
|
||||
// Unassign child curator from random account after inactivity.
|
||||
assert_ok!(ChildBounties::unassign_curator(Origin::signed(3), 0, 0));
|
||||
assert_ok!(ChildBounties::unassign_curator(RuntimeOrigin::signed(3), 0, 0));
|
||||
|
||||
// Verify updated child-bounty status.
|
||||
assert_eq!(
|
||||
@@ -960,17 +1005,22 @@ fn parent_bounty_inactive_unassign_curator_child_bounty() {
|
||||
Balances::make_free_balance_be(&7, 101); // Child-bounty curator 2.
|
||||
Balances::make_free_balance_be(&8, 101); // Child-bounty curator 3.
|
||||
|
||||
assert_ok!(Bounties::propose_bounty(Origin::signed(0), 50, b"12345".to_vec()));
|
||||
assert_ok!(Bounties::approve_bounty(Origin::root(), 0));
|
||||
assert_ok!(Bounties::propose_bounty(RuntimeOrigin::signed(0), 50, b"12345".to_vec()));
|
||||
assert_ok!(Bounties::approve_bounty(RuntimeOrigin::root(), 0));
|
||||
|
||||
System::set_block_number(2);
|
||||
<Treasury as OnInitialize<u64>>::on_initialize(2);
|
||||
|
||||
assert_ok!(Bounties::propose_curator(Origin::root(), 0, 4, 6));
|
||||
assert_ok!(Bounties::accept_curator(Origin::signed(4), 0));
|
||||
assert_ok!(Bounties::propose_curator(RuntimeOrigin::root(), 0, 4, 6));
|
||||
assert_ok!(Bounties::accept_curator(RuntimeOrigin::signed(4), 0));
|
||||
|
||||
// Create Child-bounty.
|
||||
assert_ok!(ChildBounties::add_child_bounty(Origin::signed(4), 0, 10, b"12345-p1".to_vec()));
|
||||
assert_ok!(ChildBounties::add_child_bounty(
|
||||
RuntimeOrigin::signed(4),
|
||||
0,
|
||||
10,
|
||||
b"12345-p1".to_vec()
|
||||
));
|
||||
assert_eq!(last_event(), ChildBountiesEvent::Added { index: 0, child_index: 0 });
|
||||
|
||||
System::set_block_number(3);
|
||||
@@ -978,8 +1028,8 @@ fn parent_bounty_inactive_unassign_curator_child_bounty() {
|
||||
|
||||
// Propose and accept curator for child-bounty.
|
||||
let fee = 8;
|
||||
assert_ok!(ChildBounties::propose_curator(Origin::signed(4), 0, 0, 8, fee));
|
||||
assert_ok!(ChildBounties::accept_curator(Origin::signed(8), 0, 0));
|
||||
assert_ok!(ChildBounties::propose_curator(RuntimeOrigin::signed(4), 0, 0, 8, fee));
|
||||
assert_ok!(ChildBounties::accept_curator(RuntimeOrigin::signed(8), 0, 0));
|
||||
let expected_child_deposit = CuratorDepositMultiplier::get() * fee;
|
||||
|
||||
assert_eq!(
|
||||
@@ -997,7 +1047,7 @@ fn parent_bounty_inactive_unassign_curator_child_bounty() {
|
||||
<Treasury as OnInitialize<u64>>::on_initialize(4);
|
||||
|
||||
// Unassign parent bounty curator.
|
||||
assert_ok!(Bounties::unassign_curator(Origin::root(), 0));
|
||||
assert_ok!(Bounties::unassign_curator(RuntimeOrigin::root(), 0));
|
||||
|
||||
System::set_block_number(5);
|
||||
<Treasury as OnInitialize<u64>>::on_initialize(5);
|
||||
@@ -1005,12 +1055,12 @@ fn parent_bounty_inactive_unassign_curator_child_bounty() {
|
||||
// Try unassign child-bounty curator - from non curator; non reject
|
||||
// origin; some random guy. Bounty update period is not yet complete.
|
||||
assert_noop!(
|
||||
ChildBounties::unassign_curator(Origin::signed(3), 0, 0),
|
||||
ChildBounties::unassign_curator(RuntimeOrigin::signed(3), 0, 0),
|
||||
Error::<Test>::ParentBountyNotActive
|
||||
);
|
||||
|
||||
// Unassign curator - from reject origin.
|
||||
assert_ok!(ChildBounties::unassign_curator(Origin::root(), 0, 0));
|
||||
assert_ok!(ChildBounties::unassign_curator(RuntimeOrigin::root(), 0, 0));
|
||||
|
||||
// Verify updated child-bounty status.
|
||||
assert_eq!(
|
||||
@@ -1032,16 +1082,16 @@ fn parent_bounty_inactive_unassign_curator_child_bounty() {
|
||||
<Treasury as OnInitialize<u64>>::on_initialize(6);
|
||||
|
||||
// Propose and accept curator for parent-bounty again.
|
||||
assert_ok!(Bounties::propose_curator(Origin::root(), 0, 5, 6));
|
||||
assert_ok!(Bounties::accept_curator(Origin::signed(5), 0));
|
||||
assert_ok!(Bounties::propose_curator(RuntimeOrigin::root(), 0, 5, 6));
|
||||
assert_ok!(Bounties::accept_curator(RuntimeOrigin::signed(5), 0));
|
||||
|
||||
System::set_block_number(7);
|
||||
<Treasury as OnInitialize<u64>>::on_initialize(7);
|
||||
|
||||
// Propose and accept curator for child-bounty again.
|
||||
let fee = 2;
|
||||
assert_ok!(ChildBounties::propose_curator(Origin::signed(5), 0, 0, 7, fee));
|
||||
assert_ok!(ChildBounties::accept_curator(Origin::signed(7), 0, 0));
|
||||
assert_ok!(ChildBounties::propose_curator(RuntimeOrigin::signed(5), 0, 0, 7, fee));
|
||||
assert_ok!(ChildBounties::accept_curator(RuntimeOrigin::signed(7), 0, 0));
|
||||
let expected_deposit = CuratorDepositMin::get();
|
||||
|
||||
assert_eq!(
|
||||
@@ -1059,18 +1109,18 @@ fn parent_bounty_inactive_unassign_curator_child_bounty() {
|
||||
<Treasury as OnInitialize<u64>>::on_initialize(8);
|
||||
|
||||
assert_noop!(
|
||||
ChildBounties::unassign_curator(Origin::signed(3), 0, 0),
|
||||
ChildBounties::unassign_curator(RuntimeOrigin::signed(3), 0, 0),
|
||||
BountiesError::Premature
|
||||
);
|
||||
|
||||
// Unassign parent bounty curator again.
|
||||
assert_ok!(Bounties::unassign_curator(Origin::signed(5), 0));
|
||||
assert_ok!(Bounties::unassign_curator(RuntimeOrigin::signed(5), 0));
|
||||
|
||||
System::set_block_number(9);
|
||||
<Treasury as OnInitialize<u64>>::on_initialize(9);
|
||||
|
||||
// Unassign curator again - from parent curator.
|
||||
assert_ok!(ChildBounties::unassign_curator(Origin::signed(7), 0, 0));
|
||||
assert_ok!(ChildBounties::unassign_curator(RuntimeOrigin::signed(7), 0, 0));
|
||||
|
||||
// Verify updated child-bounty status.
|
||||
assert_eq!(
|
||||
@@ -1103,24 +1153,29 @@ fn close_parent_with_child_bounty() {
|
||||
Balances::make_free_balance_be(&4, 101); // Parent-bounty curator.
|
||||
Balances::make_free_balance_be(&8, 101); // Child-bounty curator.
|
||||
|
||||
assert_ok!(Bounties::propose_bounty(Origin::signed(0), 50, b"12345".to_vec()));
|
||||
assert_ok!(Bounties::approve_bounty(Origin::root(), 0));
|
||||
assert_ok!(Bounties::propose_bounty(RuntimeOrigin::signed(0), 50, b"12345".to_vec()));
|
||||
assert_ok!(Bounties::approve_bounty(RuntimeOrigin::root(), 0));
|
||||
|
||||
// Try add child-bounty.
|
||||
// Should fail, parent bounty not active yet.
|
||||
assert_noop!(
|
||||
ChildBounties::add_child_bounty(Origin::signed(4), 0, 10, b"12345-p1".to_vec()),
|
||||
ChildBounties::add_child_bounty(RuntimeOrigin::signed(4), 0, 10, b"12345-p1".to_vec()),
|
||||
Error::<Test>::ParentBountyNotActive
|
||||
);
|
||||
|
||||
System::set_block_number(2);
|
||||
<Treasury as OnInitialize<u64>>::on_initialize(2);
|
||||
|
||||
assert_ok!(Bounties::propose_curator(Origin::root(), 0, 4, 6));
|
||||
assert_ok!(Bounties::accept_curator(Origin::signed(4), 0));
|
||||
assert_ok!(Bounties::propose_curator(RuntimeOrigin::root(), 0, 4, 6));
|
||||
assert_ok!(Bounties::accept_curator(RuntimeOrigin::signed(4), 0));
|
||||
|
||||
// Child-bounty.
|
||||
assert_ok!(ChildBounties::add_child_bounty(Origin::signed(4), 0, 10, b"12345-p1".to_vec()));
|
||||
assert_ok!(ChildBounties::add_child_bounty(
|
||||
RuntimeOrigin::signed(4),
|
||||
0,
|
||||
10,
|
||||
b"12345-p1".to_vec()
|
||||
));
|
||||
assert_eq!(last_event(), ChildBountiesEvent::Added { index: 0, child_index: 0 });
|
||||
|
||||
System::set_block_number(4);
|
||||
@@ -1129,21 +1184,21 @@ fn close_parent_with_child_bounty() {
|
||||
// Try close parent-bounty.
|
||||
// Child bounty active, can't close parent.
|
||||
assert_noop!(
|
||||
Bounties::close_bounty(Origin::root(), 0),
|
||||
Bounties::close_bounty(RuntimeOrigin::root(), 0),
|
||||
BountiesError::HasActiveChildBounty
|
||||
);
|
||||
|
||||
System::set_block_number(2);
|
||||
|
||||
// Close child-bounty.
|
||||
assert_ok!(ChildBounties::close_child_bounty(Origin::root(), 0, 0));
|
||||
assert_ok!(ChildBounties::close_child_bounty(RuntimeOrigin::root(), 0, 0));
|
||||
|
||||
// Check the child-bounty count.
|
||||
assert_eq!(ChildBounties::parent_child_bounties(0), 0);
|
||||
|
||||
// Try close parent-bounty again.
|
||||
// Should pass this time.
|
||||
assert_ok!(Bounties::close_bounty(Origin::root(), 0));
|
||||
assert_ok!(Bounties::close_bounty(RuntimeOrigin::root(), 0));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1162,17 +1217,22 @@ fn children_curator_fee_calculation_test() {
|
||||
Balances::make_free_balance_be(&4, 101); // Parent-bounty curator.
|
||||
Balances::make_free_balance_be(&8, 101); // Child-bounty curator.
|
||||
|
||||
assert_ok!(Bounties::propose_bounty(Origin::signed(0), 50, b"12345".to_vec()));
|
||||
assert_ok!(Bounties::approve_bounty(Origin::root(), 0));
|
||||
assert_ok!(Bounties::propose_bounty(RuntimeOrigin::signed(0), 50, b"12345".to_vec()));
|
||||
assert_ok!(Bounties::approve_bounty(RuntimeOrigin::root(), 0));
|
||||
|
||||
System::set_block_number(2);
|
||||
<Treasury as OnInitialize<u64>>::on_initialize(2);
|
||||
|
||||
assert_ok!(Bounties::propose_curator(Origin::root(), 0, 4, 6));
|
||||
assert_ok!(Bounties::accept_curator(Origin::signed(4), 0));
|
||||
assert_ok!(Bounties::propose_curator(RuntimeOrigin::root(), 0, 4, 6));
|
||||
assert_ok!(Bounties::accept_curator(RuntimeOrigin::signed(4), 0));
|
||||
|
||||
// Child-bounty.
|
||||
assert_ok!(ChildBounties::add_child_bounty(Origin::signed(4), 0, 10, b"12345-p1".to_vec()));
|
||||
assert_ok!(ChildBounties::add_child_bounty(
|
||||
RuntimeOrigin::signed(4),
|
||||
0,
|
||||
10,
|
||||
b"12345-p1".to_vec()
|
||||
));
|
||||
assert_eq!(last_event(), ChildBountiesEvent::Added { index: 0, child_index: 0 });
|
||||
|
||||
System::set_block_number(4);
|
||||
@@ -1181,13 +1241,13 @@ fn children_curator_fee_calculation_test() {
|
||||
let fee = 6;
|
||||
|
||||
// Propose curator for child-bounty.
|
||||
assert_ok!(ChildBounties::propose_curator(Origin::signed(4), 0, 0, 8, fee));
|
||||
assert_ok!(ChildBounties::propose_curator(RuntimeOrigin::signed(4), 0, 0, 8, fee));
|
||||
// Check curator fee added to the sum.
|
||||
assert_eq!(ChildBounties::children_curator_fees(0), fee);
|
||||
// Accept curator for child-bounty.
|
||||
assert_ok!(ChildBounties::accept_curator(Origin::signed(8), 0, 0));
|
||||
assert_ok!(ChildBounties::accept_curator(RuntimeOrigin::signed(8), 0, 0));
|
||||
// Award child-bounty.
|
||||
assert_ok!(ChildBounties::award_child_bounty(Origin::signed(8), 0, 0, 7));
|
||||
assert_ok!(ChildBounties::award_child_bounty(RuntimeOrigin::signed(8), 0, 0, 7));
|
||||
|
||||
let expected_child_deposit = CuratorDepositMultiplier::get() * fee;
|
||||
|
||||
@@ -1209,18 +1269,18 @@ fn children_curator_fee_calculation_test() {
|
||||
System::set_block_number(9);
|
||||
|
||||
// Claim child-bounty.
|
||||
assert_ok!(ChildBounties::claim_child_bounty(Origin::signed(7), 0, 0));
|
||||
assert_ok!(ChildBounties::claim_child_bounty(RuntimeOrigin::signed(7), 0, 0));
|
||||
|
||||
// Check the child-bounty count.
|
||||
assert_eq!(ChildBounties::parent_child_bounties(0), 0);
|
||||
|
||||
// Award the parent bounty.
|
||||
assert_ok!(Bounties::award_bounty(Origin::signed(4), 0, 9));
|
||||
assert_ok!(Bounties::award_bounty(RuntimeOrigin::signed(4), 0, 9));
|
||||
|
||||
System::set_block_number(15);
|
||||
|
||||
// Claim the parent bounty.
|
||||
assert_ok!(Bounties::claim_bounty(Origin::signed(9), 0));
|
||||
assert_ok!(Bounties::claim_bounty(RuntimeOrigin::signed(9), 0));
|
||||
|
||||
// Ensure parent-bounty curator received correctly reduced fee.
|
||||
assert_eq!(Balances::free_balance(4), 101 + 6 - fee); // 101 + 6 - 2
|
||||
@@ -1247,22 +1307,22 @@ fn accept_curator_handles_different_deposit_calculations() {
|
||||
Balances::make_free_balance_be(&Treasury::account_id(), parent_value * 3);
|
||||
Balances::make_free_balance_be(&parent_curator, parent_fee * 100);
|
||||
assert_ok!(Bounties::propose_bounty(
|
||||
Origin::signed(parent_curator),
|
||||
RuntimeOrigin::signed(parent_curator),
|
||||
parent_value,
|
||||
b"12345".to_vec()
|
||||
));
|
||||
assert_ok!(Bounties::approve_bounty(Origin::root(), parent_index));
|
||||
assert_ok!(Bounties::approve_bounty(RuntimeOrigin::root(), parent_index));
|
||||
|
||||
System::set_block_number(2);
|
||||
<Treasury as OnInitialize<u64>>::on_initialize(2);
|
||||
|
||||
assert_ok!(Bounties::propose_curator(
|
||||
Origin::root(),
|
||||
RuntimeOrigin::root(),
|
||||
parent_index,
|
||||
parent_curator,
|
||||
parent_fee
|
||||
));
|
||||
assert_ok!(Bounties::accept_curator(Origin::signed(parent_curator), parent_index));
|
||||
assert_ok!(Bounties::accept_curator(RuntimeOrigin::signed(parent_curator), parent_index));
|
||||
|
||||
// Now we can start creating some child bounties.
|
||||
// Case 1: Parent and child curator are not the same.
|
||||
@@ -1275,7 +1335,7 @@ fn accept_curator_handles_different_deposit_calculations() {
|
||||
|
||||
Balances::make_free_balance_be(&child_curator, starting_balance);
|
||||
assert_ok!(ChildBounties::add_child_bounty(
|
||||
Origin::signed(parent_curator),
|
||||
RuntimeOrigin::signed(parent_curator),
|
||||
parent_index,
|
||||
child_value,
|
||||
b"12345-p1".to_vec()
|
||||
@@ -1283,14 +1343,14 @@ fn accept_curator_handles_different_deposit_calculations() {
|
||||
System::set_block_number(3);
|
||||
<Treasury as OnInitialize<u64>>::on_initialize(3);
|
||||
assert_ok!(ChildBounties::propose_curator(
|
||||
Origin::signed(parent_curator),
|
||||
RuntimeOrigin::signed(parent_curator),
|
||||
parent_index,
|
||||
child_index,
|
||||
child_curator,
|
||||
child_fee
|
||||
));
|
||||
assert_ok!(ChildBounties::accept_curator(
|
||||
Origin::signed(child_curator),
|
||||
RuntimeOrigin::signed(child_curator),
|
||||
parent_index,
|
||||
child_index
|
||||
));
|
||||
@@ -1310,7 +1370,7 @@ fn accept_curator_handles_different_deposit_calculations() {
|
||||
let reserved_before = Balances::reserved_balance(&parent_curator);
|
||||
|
||||
assert_ok!(ChildBounties::add_child_bounty(
|
||||
Origin::signed(parent_curator),
|
||||
RuntimeOrigin::signed(parent_curator),
|
||||
parent_index,
|
||||
child_value,
|
||||
b"12345-p1".to_vec()
|
||||
@@ -1318,14 +1378,14 @@ fn accept_curator_handles_different_deposit_calculations() {
|
||||
System::set_block_number(4);
|
||||
<Treasury as OnInitialize<u64>>::on_initialize(4);
|
||||
assert_ok!(ChildBounties::propose_curator(
|
||||
Origin::signed(parent_curator),
|
||||
RuntimeOrigin::signed(parent_curator),
|
||||
parent_index,
|
||||
child_index,
|
||||
child_curator,
|
||||
child_fee
|
||||
));
|
||||
assert_ok!(ChildBounties::accept_curator(
|
||||
Origin::signed(child_curator),
|
||||
RuntimeOrigin::signed(child_curator),
|
||||
parent_index,
|
||||
child_index
|
||||
));
|
||||
@@ -1343,7 +1403,7 @@ fn accept_curator_handles_different_deposit_calculations() {
|
||||
|
||||
Balances::make_free_balance_be(&child_curator, starting_balance);
|
||||
assert_ok!(ChildBounties::add_child_bounty(
|
||||
Origin::signed(parent_curator),
|
||||
RuntimeOrigin::signed(parent_curator),
|
||||
parent_index,
|
||||
child_value,
|
||||
b"12345-p1".to_vec()
|
||||
@@ -1351,14 +1411,14 @@ fn accept_curator_handles_different_deposit_calculations() {
|
||||
System::set_block_number(5);
|
||||
<Treasury as OnInitialize<u64>>::on_initialize(5);
|
||||
assert_ok!(ChildBounties::propose_curator(
|
||||
Origin::signed(parent_curator),
|
||||
RuntimeOrigin::signed(parent_curator),
|
||||
parent_index,
|
||||
child_index,
|
||||
child_curator,
|
||||
child_fee
|
||||
));
|
||||
assert_ok!(ChildBounties::accept_curator(
|
||||
Origin::signed(child_curator),
|
||||
RuntimeOrigin::signed(child_curator),
|
||||
parent_index,
|
||||
child_index
|
||||
));
|
||||
@@ -1379,7 +1439,7 @@ fn accept_curator_handles_different_deposit_calculations() {
|
||||
|
||||
Balances::make_free_balance_be(&child_curator, starting_balance);
|
||||
assert_ok!(ChildBounties::add_child_bounty(
|
||||
Origin::signed(parent_curator),
|
||||
RuntimeOrigin::signed(parent_curator),
|
||||
parent_index,
|
||||
child_value,
|
||||
b"12345-p1".to_vec()
|
||||
@@ -1387,14 +1447,14 @@ fn accept_curator_handles_different_deposit_calculations() {
|
||||
System::set_block_number(5);
|
||||
<Treasury as OnInitialize<u64>>::on_initialize(5);
|
||||
assert_ok!(ChildBounties::propose_curator(
|
||||
Origin::signed(parent_curator),
|
||||
RuntimeOrigin::signed(parent_curator),
|
||||
parent_index,
|
||||
child_index,
|
||||
child_curator,
|
||||
child_fee
|
||||
));
|
||||
assert_ok!(ChildBounties::accept_curator(
|
||||
Origin::signed(child_curator),
|
||||
RuntimeOrigin::signed(child_curator),
|
||||
parent_index,
|
||||
child_index
|
||||
));
|
||||
|
||||
Reference in New Issue
Block a user