Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add some events for pallet-bounties #1706

Merged
merged 2 commits into from
Sep 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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