mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-22 21:55:45 +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.
|
/// A proposal_hash has been blacklisted permanently.
|
||||||
Blacklisted { proposal_hash: T::Hash },
|
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]
|
#[pallet::error]
|
||||||
@@ -677,8 +681,9 @@ pub mod pallet {
|
|||||||
ensure!(seconds <= seconds_upper_bound, Error::<T>::WrongUpperBound);
|
ensure!(seconds <= seconds_upper_bound, Error::<T>::WrongUpperBound);
|
||||||
let mut deposit = Self::deposit_of(proposal).ok_or(Error::<T>::ProposalMissing)?;
|
let mut deposit = Self::deposit_of(proposal).ok_or(Error::<T>::ProposalMissing)?;
|
||||||
T::Currency::reserve(&who, deposit.1)?;
|
T::Currency::reserve(&who, deposit.1)?;
|
||||||
deposit.0.push(who);
|
deposit.0.push(who.clone());
|
||||||
<DepositOf<T>>::insert(proposal, deposit);
|
<DepositOf<T>>::insert(proposal, deposit);
|
||||||
|
Self::deposit_event(Event::<T>::Seconded { seconder: who, prop_index: proposal });
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1378,6 +1383,7 @@ impl<T: Config> Pallet<T> {
|
|||||||
votes.insert(i, (ref_index, vote));
|
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.
|
// Shouldn't be possible to fail, but we handle it gracefully.
|
||||||
status.tally.add(vote).ok_or(ArithmeticError::Overflow)?;
|
status.tally.add(vote).ok_or(ArithmeticError::Overflow)?;
|
||||||
if let Some(approve) = vote.as_standard() {
|
if let Some(approve) = vote.as_standard() {
|
||||||
|
|||||||
Reference in New Issue
Block a user