add some events for pallet-bounties (#1706)

Add missing events for pallet-bounties
This commit is contained in:
Xiliang Chen
2023-09-29 00:04:35 +13:00
committed by GitHub
parent 4384c613af
commit b50d8e6f7f
+20 -2
View File
@@ -291,6 +291,14 @@ pub mod pallet {
BountyCanceled { index: BountyIndex }, BountyCanceled { index: BountyIndex },
/// A bounty expiry is extended. /// A bounty expiry is extended.
BountyExtended { index: BountyIndex }, 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. /// Number of bounty proposals that have been made.
@@ -375,10 +383,12 @@ pub mod pallet {
Ok(()) Ok(())
})?; })?;
Self::deposit_event(Event::<T, I>::BountyApproved { index: bounty_id });
Ok(()) Ok(())
} }
/// Assign a curator to a funded bounty. /// Propose a curator to a funded bounty.
/// ///
/// May only be called from `T::SpendOrigin`. /// May only be called from `T::SpendOrigin`.
/// ///
@@ -408,9 +418,11 @@ pub mod pallet {
ensure!(fee < bounty.value, Error::<T, I>::InvalidFee); ensure!(fee < bounty.value, Error::<T, I>::InvalidFee);
bounty.status = BountyStatus::CuratorProposed { curator }; bounty.status = BountyStatus::CuratorProposed { curator: curator.clone() };
bounty.fee = fee; bounty.fee = fee;
Self::deposit_event(Event::<T, I>::CuratorProposed { bounty_id, curator });
Ok(()) Ok(())
})?; })?;
Ok(()) Ok(())
@@ -508,6 +520,8 @@ pub mod pallet {
bounty.status = BountyStatus::Funded; bounty.status = BountyStatus::Funded;
Ok(()) Ok(())
})?; })?;
Self::deposit_event(Event::<T, I>::CuratorUnassigned { bounty_id });
Ok(()) Ok(())
} }
@@ -542,6 +556,10 @@ pub mod pallet {
bounty.status = bounty.status =
BountyStatus::Active { curator: curator.clone(), update_due }; BountyStatus::Active { curator: curator.clone(), update_due };
Self::deposit_event(Event::<T, I>::CuratorAccepted {
bounty_id,
curator: signer,
});
Ok(()) Ok(())
}, },
_ => Err(Error::<T, I>::UnexpectedStatus.into()), _ => Err(Error::<T, I>::UnexpectedStatus.into()),