mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-29 05:37:58 +00:00
Add vote and seconded events to Democracy pallet. (#10352)
* add the events * spec_version * Update bin/node/runtime/src/lib.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: Alan Sapede <alan.sapede@gmail.com> Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
@@ -539,6 +539,10 @@ pub mod pallet {
|
||||
},
|
||||
/// A proposal_hash has been blacklisted permanently.
|
||||
Blacklisted { proposal_hash: T::Hash },
|
||||
/// An account has voted in a referendum
|
||||
Voted { voter: T::AccountId, ref_index: ReferendumIndex, vote: AccountVote<BalanceOf<T>> },
|
||||
/// An account has secconded a proposal
|
||||
Seconded { seconder: T::AccountId, prop_index: PropIndex },
|
||||
}
|
||||
|
||||
#[pallet::error]
|
||||
@@ -677,8 +681,9 @@ pub mod pallet {
|
||||
ensure!(seconds <= seconds_upper_bound, Error::<T>::WrongUpperBound);
|
||||
let mut deposit = Self::deposit_of(proposal).ok_or(Error::<T>::ProposalMissing)?;
|
||||
T::Currency::reserve(&who, deposit.1)?;
|
||||
deposit.0.push(who);
|
||||
deposit.0.push(who.clone());
|
||||
<DepositOf<T>>::insert(proposal, deposit);
|
||||
Self::deposit_event(Event::<T>::Seconded { seconder: who, prop_index: proposal });
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -1378,6 +1383,7 @@ impl<T: Config> Pallet<T> {
|
||||
votes.insert(i, (ref_index, vote));
|
||||
},
|
||||
}
|
||||
Self::deposit_event(Event::<T>::Voted { voter: who.clone(), ref_index, vote });
|
||||
// Shouldn't be possible to fail, but we handle it gracefully.
|
||||
status.tally.add(vote).ok_or(ArithmeticError::Overflow)?;
|
||||
if let Some(approve) = vote.as_standard() {
|
||||
|
||||
Reference in New Issue
Block a user