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

include events for voting #4613

10 changes: 10 additions & 0 deletions prdoc/pr_4613.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
title: "Include events for vote and remove vote"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
title: "Include events for vote and remove vote"
title: "pallet-conviction-voting: Include events for vote and remove vote"

Otherwise the CHANGELOG will read a bit weird.


doc:
- audience: Runtime User
description: |
Includes event for vote and remove_vote
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd mention what the fields are


crates:
- name: pallet-conviction-voting
bump: patch
dharjeezy marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 6 additions & 0 deletions substrate/frame/conviction-voting/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ pub mod pallet {
Delegated(T::AccountId, T::AccountId),
/// An \[account\] has cancelled a previous delegation operation.
Undelegated(T::AccountId),
/// An account that has voted
VoteEnacted { who: T::AccountId, vote: AccountVote<BalanceOf<T, I>> },
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
VoteEnacted { who: T::AccountId, vote: AccountVote<BalanceOf<T, I>> },
Voted { who: T::AccountId, vote: AccountVote<BalanceOf<T, I>> },

Enacted sounds to me more final.

/// A vote that been removed
VoteRemoved { who: T::AccountId, vote: AccountVote<BalanceOf<T, I>> },
}

#[pallet::error]
Expand Down Expand Up @@ -427,6 +431,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
// Extend the lock to `balance` (rather than setting it) since we don't know what
// other votes are in place.
Self::extend_lock(who, &class, vote.balance());
Self::deposit_event(Event::VoteEnacted { who: who.clone(), vote });
Ok(())
})
})
Expand Down Expand Up @@ -462,6 +467,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
if let Some(approve) = v.1.as_standard() {
tally.reduce(approve, *delegations);
}
Self::deposit_event(Event::VoteRemoved { who: who.clone(), vote: v.1 });
Ok(())
},
PollStatus::Completed(end, approved) => {
Expand Down
Loading