Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Missing Events for Balances Pallet #7250

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Doordashcon
Copy link
Contributor

Attempts to resolve #6974

Comment on lines 388 to 391
/// Some balance of who is currently being held.
Holding { reason: T::RuntimeHoldReason, who: T::AccountId, amount: T::Balance },
/// Some balance of who has been released.
Released { reason: T::RuntimeHoldReason, who: T::AccountId, amount: T::Balance }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may be?

Suggested change
/// Some balance of who is currently being held.
Holding { reason: T::RuntimeHoldReason, who: T::AccountId, amount: T::Balance },
/// Some balance of who has been released.
Released { reason: T::RuntimeHoldReason, who: T::AccountId, amount: T::Balance }
/// Some balance was placed on hold.
Held { reason: T::RuntimeHoldReason, who: T::AccountId, amount: T::Balance },
/// Some balance was released from hold.
Released { reason: T::RuntimeHoldReason, who: T::AccountId, amount: T::Balance }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@Yung-Beef
Copy link

Any update on this?

@ggwpez
Copy link
Member

ggwpez commented Mar 4, 2025

Why draft? Is it okay to review?

@Doordashcon Doordashcon marked this pull request as ready for review March 9, 2025 23:57
@Doordashcon Doordashcon requested a review from a team as a code owner March 9, 2025 23:57
@@ -62,7 +64,7 @@ impl<B: Balance, OnDrop: HandleImbalanceDrop<B>, OppositeOnDrop: HandleImbalance
{
fn drop(&mut self) {
if !self.amount.is_zero() {
OnDrop::handle(self.amount)
OnDrop::handle(self.amount) // here.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is here?

fn done_release(reason: &Self::Reason, who: &T::AccountId, amount: Self::Balance) {
Self::deposit_event(Event::<T, I>::Released { reason: *reason, who: who.clone(), amount });
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's implement all of them no?

	fn done_hold(_reason: &Self::Reason, _who: &AccountId, _amount: Self::Balance) {}
	fn done_release(_reason: &Self::Reason, _who: &AccountId, _amount: Self::Balance) {}
	fn done_burn_held(_reason: &Self::Reason, _who: &AccountId, _amount: Self::Balance) {}
	fn done_transfer_on_hold(
		_reason: &Self::Reason,
		_source: &AccountId,
		_dest: &AccountId,
		_amount: Self::Balance,
	) {
	}
	fn done_transfer_and_hold(
		_reason: &Self::Reason,
		_source: &AccountId,
		_dest: &AccountId,
		_transferred: Self::Balance,
	) {
	}

@@ -343,6 +350,20 @@ impl<T: Config<I>, I: 'static> fungible::MutateFreeze<T::AccountId> for Pallet<T
}
}

impl<T: Config<I>, I: 'static> HandleImbalanceDrop<T::Balance> for fungible::DecreaseIssuance<T::AccountId, Pallet<T, I>> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either you make fungible::DecreaseIssuance generic over the event, or you need to recreate an implementation of HandleImbalanceDrop here to a new type only for pallet-balances.
Because this will not compile.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can implement for PositiveImbalance and NegativeImbalance

@paritytech-review-bot paritytech-review-bot bot requested a review from a team March 11, 2025 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Missing Events for Balances Pallet
5 participants