mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 20:27:58 +00:00
Refactor as_sub to make things clearer. (#6503)
* Refactor as_sub to make things clearer. - `as_sub` becomes `as_alternative` - `as_sub_limited` becomes `as_derivative` - `as_alternative` and `as_derivative` generate a mutually exclusive set of accounts. * Test fix * Add test * Fix test * Remove `as_alternative`. * Docs.
This commit is contained in:
@@ -201,19 +201,11 @@ fn filtering_works() {
|
||||
assert_ok!(Proxy::proxy(Origin::signed(4), 1, None, call.clone()));
|
||||
expect_event(RawEvent::ProxyExecuted(Err(DispatchError::BadOrigin)));
|
||||
|
||||
let sub_id = Utility::sub_account_id(1, 0);
|
||||
Balances::mutate_account(&sub_id, |a| a.free = 1000);
|
||||
let derivative_id = Utility::derivative_account_id(1, 0);
|
||||
Balances::mutate_account(&derivative_id, |a| a.free = 1000);
|
||||
let inner = Box::new(Call::Balances(BalancesCall::transfer(6, 1)));
|
||||
|
||||
let call = Box::new(Call::Utility(UtilityCall::as_sub(0, inner.clone())));
|
||||
assert_ok!(Proxy::proxy(Origin::signed(2), 1, None, call.clone()));
|
||||
expect_event(RawEvent::ProxyExecuted(Ok(())));
|
||||
assert_ok!(Proxy::proxy(Origin::signed(3), 1, None, call.clone()));
|
||||
expect_event(RawEvent::ProxyExecuted(Err(DispatchError::BadOrigin)));
|
||||
assert_ok!(Proxy::proxy(Origin::signed(4), 1, None, call.clone()));
|
||||
expect_event(RawEvent::ProxyExecuted(Ok(())));
|
||||
|
||||
let call = Box::new(Call::Utility(UtilityCall::as_limited_sub(0, inner.clone())));
|
||||
let call = Box::new(Call::Utility(UtilityCall::as_derivative(0, inner.clone())));
|
||||
assert_ok!(Proxy::proxy(Origin::signed(2), 1, None, call.clone()));
|
||||
expect_event(RawEvent::ProxyExecuted(Ok(())));
|
||||
assert_ok!(Proxy::proxy(Origin::signed(3), 1, None, call.clone()));
|
||||
|
||||
Reference in New Issue
Block a user