Skip to content

Commit

Permalink
add some events for pallet-bounties (#1706)
Browse files Browse the repository at this point in the history
Add missing events for pallet-bounties
  • Loading branch information
xlc committed Sep 28, 2023
1 parent 4384c61 commit b50d8e6
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions substrate/frame/bounties/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,14 @@ pub mod pallet {
BountyCanceled { index: BountyIndex },
/// A bounty expiry is extended.
BountyExtended { index: BountyIndex },
/// A bounty is approved.
BountyApproved { index: BountyIndex },
/// A bounty curator is proposed.
CuratorProposed { bounty_id: BountyIndex, curator: T::AccountId },
/// A bounty curator is unassigned.
CuratorUnassigned { bounty_id: BountyIndex },
/// A bounty curator is accepted.
CuratorAccepted { bounty_id: BountyIndex, curator: T::AccountId },
}

/// Number of bounty proposals that have been made.
Expand Down Expand Up @@ -375,10 +383,12 @@ pub mod pallet {

Ok(())
})?;

Self::deposit_event(Event::<T, I>::BountyApproved { index: bounty_id });
Ok(())
}

/// Assign a curator to a funded bounty.
/// Propose a curator to a funded bounty.
///
/// May only be called from `T::SpendOrigin`.
///
Expand Down Expand Up @@ -408,9 +418,11 @@ pub mod pallet {

ensure!(fee < bounty.value, Error::<T, I>::InvalidFee);

bounty.status = BountyStatus::CuratorProposed { curator };
bounty.status = BountyStatus::CuratorProposed { curator: curator.clone() };
bounty.fee = fee;

Self::deposit_event(Event::<T, I>::CuratorProposed { bounty_id, curator });

Ok(())
})?;
Ok(())
Expand Down Expand Up @@ -508,6 +520,8 @@ pub mod pallet {
bounty.status = BountyStatus::Funded;
Ok(())
})?;

Self::deposit_event(Event::<T, I>::CuratorUnassigned { bounty_id });
Ok(())
}

Expand Down Expand Up @@ -542,6 +556,10 @@ pub mod pallet {
bounty.status =
BountyStatus::Active { curator: curator.clone(), update_due };

Self::deposit_event(Event::<T, I>::CuratorAccepted {
bounty_id,
curator: signer,
});
Ok(())
},
_ => Err(Error::<T, I>::UnexpectedStatus.into()),
Expand Down

0 comments on commit b50d8e6

Please sign in to comment.