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

Next Next commit
include event for voting
  • Loading branch information
dharjeezy committed May 28, 2024
commit e11244385d7dc29c046972ea4d2168f1f5898388
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