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:
David Salami
2021-11-16 02:56:00 +01:00
committed by GitHub
parent fb3c7326c2
commit 120894fdb7
48 changed files with 1181 additions and 681 deletions
+24 -12
View File
@@ -272,17 +272,23 @@ pub mod pallet {
#[pallet::generate_deposit(pub(super) fn deposit_event)]
pub enum Event<T: Config> {
/// A bid was successfully placed.
/// \[ who, amount, duration \]
BidPlaced(T::AccountId, BalanceOf<T>, u32),
BidPlaced { who: T::AccountId, amount: BalanceOf<T>, duration: u32 },
/// A bid was successfully removed (before being accepted as a gilt).
/// \[ who, amount, duration \]
BidRetracted(T::AccountId, BalanceOf<T>, u32),
BidRetracted { who: T::AccountId, amount: BalanceOf<T>, duration: u32 },
/// A bid was accepted as a gilt. The balance may not be released until expiry.
/// \[ index, expiry, who, amount \]
GiltIssued(ActiveIndex, T::BlockNumber, T::AccountId, BalanceOf<T>),
GiltIssued {
index: ActiveIndex,
expiry: T::BlockNumber,
who: T::AccountId,
amount: BalanceOf<T>,
},
/// An expired gilt has been thawed.
/// \[ index, who, original_amount, additional_amount \]
GiltThawed(ActiveIndex, T::AccountId, BalanceOf<T>, BalanceOf<T>),
GiltThawed {
index: ActiveIndex,
who: T::AccountId,
original_amount: BalanceOf<T>,
additional_amount: BalanceOf<T>,
},
}
#[pallet::error]
@@ -376,7 +382,7 @@ pub mod pallet {
qs[queue_index].0 += net.0;
qs[queue_index].1 = qs[queue_index].1.saturating_add(net.1);
});
Self::deposit_event(Event::BidPlaced(who.clone(), amount, duration));
Self::deposit_event(Event::BidPlaced { who: who.clone(), amount, duration });
Ok(().into())
}
@@ -414,7 +420,7 @@ pub mod pallet {
});
T::Currency::unreserve(&bid.who, bid.amount);
Self::deposit_event(Event::BidRetracted(bid.who, bid.amount, duration));
Self::deposit_event(Event::BidRetracted { who: bid.who, amount: bid.amount, duration });
Ok(().into())
}
@@ -493,7 +499,12 @@ pub mod pallet {
debug_assert!(err_amt.is_zero());
}
let e = Event::GiltThawed(index, gilt.who, gilt.amount, gilt_value);
let e = Event::GiltThawed {
index,
who: gilt.who,
original_amount: gilt.amount,
additional_amount: gilt_value,
};
Self::deposit_event(e);
});
@@ -603,7 +614,8 @@ pub mod pallet {
totals.frozen += bid.amount;
totals.proportion = totals.proportion.saturating_add(proportion);
totals.index += 1;
let e = Event::GiltIssued(index, expiry, who.clone(), amount);
let e =
Event::GiltIssued { index, expiry, who: who.clone(), amount };
Self::deposit_event(e);
let gilt = ActiveGilt { amount, proportion, who, expiry };
Active::<T>::insert(index, gilt);