Skip to content

Commit

Permalink
include events for voting (paritytech#4613)
Browse files Browse the repository at this point in the history
closes paritytech#143

Polkadot address: 12GyGD3QhT4i2JJpNzvMf96sxxBLWymz4RdGCxRH5Rj5agKW

---------

Co-authored-by: Muharem <ismailov.m.h@gmail.com>
  • Loading branch information
2 people authored and TarekkMA committed Aug 2, 2024
1 parent 051bb3a commit 0beeaf1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
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: "pallet-conviction-voting: Include events for vote and remove vote"

doc:
- audience: Runtime User
description: |
Introduce event called `Voted: { who: T::AccountId, vote: AccountVote<BalanceOf<T, I>> }` and `VoteRemoved: { who: T::AccountId, vote: AccountVote<BalanceOf<T, I>> }`

crates:
- name: pallet-conviction-voting
bump: major
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 @@ -171,6 +171,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
Voted { who: T::AccountId, vote: AccountVote<BalanceOf<T, I>> },
/// A vote that been removed
VoteRemoved { who: T::AccountId, vote: AccountVote<BalanceOf<T, I>> },
}

#[pallet::error]
Expand Down Expand Up @@ -428,6 +432,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::Voted { who: who.clone(), vote });
Ok(())
})
})
Expand Down Expand Up @@ -463,6 +468,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

0 comments on commit 0beeaf1

Please sign in to comment.