From e6b8a696564afb0bdf2d0507ae6223ad00202454 Mon Sep 17 00:00:00 2001 From: Gavin Wood Date: Fri, 20 Dec 2019 21:35:51 +0100 Subject: [PATCH] Add ProposalRejected event to Treasury (#4468) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #4467 Co-authored-by: Bastian Köcher --- substrate/frame/treasury/src/lib.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/substrate/frame/treasury/src/lib.rs b/substrate/frame/treasury/src/lib.rs index 6e1c6fb8d8..121432fd05 100644 --- a/substrate/frame/treasury/src/lib.rs +++ b/substrate/frame/treasury/src/lib.rs @@ -167,11 +167,13 @@ decl_module! { #[weight = SimpleDispatchInfo::FixedOperational(100_000)] fn reject_proposal(origin, #[compact] proposal_id: ProposalIndex) { T::RejectOrigin::ensure_origin(origin)?; - let proposal = >::take(proposal_id).ok_or(Error::::InvalidProposalIndex)?; + let proposal = >::take(&proposal_id).ok_or(Error::::InvalidProposalIndex)?; let value = proposal.bond; let imbalance = T::Currency::slash_reserved(&proposal.proposer, value).0; T::ProposalRejection::on_unbalanced(imbalance); + + Self::deposit_event(Event::::Rejected(proposal_id, value)); } /// Approve a proposal. At a later time, the proposal will be allocated to the beneficiary @@ -244,6 +246,8 @@ decl_event!( Spending(Balance), /// Some funds have been allocated. Awarded(ProposalIndex, Balance, AccountId), + /// A proposal was rejected; funds were slashed. + Rejected(ProposalIndex, Balance), /// Some of our funds have been burnt. Burnt(Balance), /// Spending has finished; this is the amount that rolls over until next spend.