Skip to content

Commit

Permalink
fix: Do not emit Issued { amount: 0 } event
Browse files Browse the repository at this point in the history
  • Loading branch information
ShoyuVanilla committed Oct 7, 2024
1 parent fe0bfb7 commit 1e36e4e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
15 changes: 15 additions & 0 deletions prdoc/pr_5946.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0
# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json

title: "[FRAME] fix: Do not emit `Issued { amount: 0 }` event"

doc:
- audience:
- Runtime Dev
- Runtime User
description: |
Filter out `Issued` events in `pallet-balances` module when its balance amount is zero.

crates:
- name: pallet-balances
bump: patch
4 changes: 3 additions & 1 deletion substrate/frame/balances/src/impl_fungible.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,9 @@ impl<T: Config<I>, I: 'static> fungible::Balanced<T::AccountId> for Pallet<T, I>
Self::deposit_event(Event::<T, I>::Withdraw { who: who.clone(), amount });
}
fn done_issue(amount: Self::Balance) {
Self::deposit_event(Event::<T, I>::Issued { amount });
if !amount.is_zero() {
Self::deposit_event(Event::<T, I>::Issued { amount });
}
}
fn done_rescind(amount: Self::Balance) {
Self::deposit_event(Event::<T, I>::Rescinded { amount });
Expand Down

0 comments on commit 1e36e4e

Please sign in to comment.