mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-13 10:25:50 +00:00
Add field names to pallet Event variants (#9993)
* convert pallet-assets events to struct types * updated events of a couple pallets * updated pallet event field names * update pallet event field names * updated events in test files * cargo fmt * minorfixes * fix assertion error * minor fix * formatting fix * fmt
This commit is contained in:
@@ -314,7 +314,7 @@ macro_rules! decl_tests {
|
||||
<$ext_builder>::default().monied(true).build().execute_with(|| {
|
||||
assert_eq!(Balances::total_balance(&1), 10);
|
||||
assert_ok!(Balances::deposit_into_existing(&1, 10).map(drop));
|
||||
System::assert_last_event(Event::Balances(crate::Event::Deposit(1, 10)));
|
||||
System::assert_last_event(Event::Balances(crate::Event::Deposit { who: 1, amount: 10 }));
|
||||
assert_eq!(Balances::total_balance(&1), 20);
|
||||
assert_eq!(<TotalIssuance<$test>>::get(), 120);
|
||||
});
|
||||
@@ -342,7 +342,7 @@ macro_rules! decl_tests {
|
||||
fn balance_works() {
|
||||
<$ext_builder>::default().build().execute_with(|| {
|
||||
let _ = Balances::deposit_creating(&1, 42);
|
||||
System::assert_has_event(Event::Balances(crate::Event::Deposit(1, 42)));
|
||||
System::assert_has_event(Event::Balances(crate::Event::Deposit { who: 1, amount: 42 }));
|
||||
assert_eq!(Balances::free_balance(1), 42);
|
||||
assert_eq!(Balances::reserved_balance(1), 0);
|
||||
assert_eq!(Balances::total_balance(&1), 42);
|
||||
@@ -444,7 +444,7 @@ macro_rules! decl_tests {
|
||||
let _ = Balances::withdraw(
|
||||
&2, 11, WithdrawReasons::TRANSFER, ExistenceRequirement::KeepAlive
|
||||
);
|
||||
System::assert_last_event(Event::Balances(crate::Event::Withdraw(2, 11)));
|
||||
System::assert_last_event(Event::Balances(crate::Event::Withdraw { who: 2, amount: 11 }));
|
||||
assert_eq!(Balances::free_balance(2), 100);
|
||||
assert_eq!(<TotalIssuance<$test>>::get(), 100);
|
||||
});
|
||||
@@ -505,7 +505,7 @@ macro_rules! decl_tests {
|
||||
assert_ok!(Balances::reserve(&1, 110));
|
||||
assert_ok!(Balances::repatriate_reserved(&1, &2, 41, Status::Free), 0);
|
||||
System::assert_last_event(
|
||||
Event::Balances(crate::Event::ReserveRepatriated(1, 2, 41, Status::Free))
|
||||
Event::Balances(crate::Event::ReserveRepatriated { from: 1, to: 2, amount: 41, destination_status: Status::Free })
|
||||
);
|
||||
assert_eq!(Balances::reserved_balance(1), 69);
|
||||
assert_eq!(Balances::free_balance(1), 0);
|
||||
@@ -724,18 +724,18 @@ macro_rules! decl_tests {
|
||||
System::set_block_number(2);
|
||||
assert_ok!(Balances::reserve(&1, 10));
|
||||
|
||||
System::assert_last_event(Event::Balances(crate::Event::Reserved(1, 10)));
|
||||
System::assert_last_event(Event::Balances(crate::Event::Reserved { who: 1, amount: 10 }));
|
||||
|
||||
System::set_block_number(3);
|
||||
assert!(Balances::unreserve(&1, 5).is_zero());
|
||||
|
||||
System::assert_last_event(Event::Balances(crate::Event::Unreserved(1, 5)));
|
||||
System::assert_last_event(Event::Balances(crate::Event::Unreserved { who: 1, amount: 5 }));
|
||||
|
||||
System::set_block_number(4);
|
||||
assert_eq!(Balances::unreserve(&1, 6), 1);
|
||||
|
||||
// should only unreserve 5
|
||||
System::assert_last_event(Event::Balances(crate::Event::Unreserved(1, 5)));
|
||||
System::assert_last_event(Event::Balances(crate::Event::Unreserved { who: 1, amount: 5 }));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -751,8 +751,8 @@ macro_rules! decl_tests {
|
||||
events(),
|
||||
[
|
||||
Event::System(system::Event::NewAccount(1)),
|
||||
Event::Balances(crate::Event::Endowed(1, 100)),
|
||||
Event::Balances(crate::Event::BalanceSet(1, 100, 0)),
|
||||
Event::Balances(crate::Event::Endowed { account: 1, free_balance: 100 }),
|
||||
Event::Balances(crate::Event::BalanceSet { who: 1, free: 100, reserved: 0 }),
|
||||
]
|
||||
);
|
||||
|
||||
@@ -763,8 +763,8 @@ macro_rules! decl_tests {
|
||||
events(),
|
||||
[
|
||||
Event::System(system::Event::KilledAccount(1)),
|
||||
Event::Balances(crate::Event::DustLost(1, 99)),
|
||||
Event::Balances(crate::Event::Slashed(1, 1)),
|
||||
Event::Balances(crate::Event::DustLost { account: 1, amount: 99 }),
|
||||
Event::Balances(crate::Event::Slashed { who: 1, amount: 1 }),
|
||||
]
|
||||
);
|
||||
});
|
||||
@@ -782,8 +782,8 @@ macro_rules! decl_tests {
|
||||
events(),
|
||||
[
|
||||
Event::System(system::Event::NewAccount(1)),
|
||||
Event::Balances(crate::Event::Endowed(1, 100)),
|
||||
Event::Balances(crate::Event::BalanceSet(1, 100, 0)),
|
||||
Event::Balances(crate::Event::Endowed { account: 1, free_balance: 100 }),
|
||||
Event::Balances(crate::Event::BalanceSet { who: 1, free: 100, reserved: 0 }),
|
||||
]
|
||||
);
|
||||
|
||||
@@ -794,7 +794,7 @@ macro_rules! decl_tests {
|
||||
events(),
|
||||
[
|
||||
Event::System(system::Event::KilledAccount(1)),
|
||||
Event::Balances(crate::Event::Slashed(1, 100)),
|
||||
Event::Balances(crate::Event::Slashed { who: 1, amount: 100 }),
|
||||
]
|
||||
);
|
||||
});
|
||||
@@ -814,7 +814,7 @@ macro_rules! decl_tests {
|
||||
assert_eq!(Balances::slash(&1, 900), (NegativeImbalance::new(900), 0));
|
||||
// Account is still alive
|
||||
assert!(System::account_exists(&1));
|
||||
System::assert_last_event(Event::Balances(crate::Event::Slashed(1, 900)));
|
||||
System::assert_last_event(Event::Balances(crate::Event::Slashed { who: 1, amount: 900 }));
|
||||
|
||||
// SCENARIO: Slash will kill account because not enough balance left.
|
||||
assert_ok!(Balances::set_balance(Origin::root(), 1, 1_000, 0));
|
||||
|
||||
Reference in New Issue
Block a user