This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
[feature request] Add voting hooks #14559
Labels
J0-enhancement
An additional feature request.
J2-unconfirmed
Issue might be valid, but it’s not yet known.
Is there an existing issue?
Experiencing problems? Have you tried our Stack Exchange first?
Motivation
We, in HydraDX, would need to execute additional custom logic when referendum vote is added or removed.
Currently, there does not seem to be a way where we can easily add a hook which would execute when a vote is added or removed.
Request
We would like to propose adding hooks into “old” democracy pallet as well as to conviction-voting pallet.
We can easily prepare a PR with such change, but i figured i would open an issue first to discuss if this is something that can be added and/or hear anything against it.
Solution
We would imagine having a trait similar to this one:
The hooks would be executed in try_vote and try_remove_vote.
Perhaps , ReferendumIndex would need to be generic as well, to have only one trait used in both democracy pallet and conviction-voting pallet.
Regarding benchmarking and weights - special trait functions can be added to prepare worst case scenario.
Are you willing to help with this request?
Yes!
The text was updated successfully, but these errors were encountered: