Use voting aggregator to aggregate token manager hooks as well #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Until now we only could register hooks (such as Conviction Voting) directly to the Hooked Token Manager, so we were forced to use just one token to govern the funding in Gardens:
We are planing to de-hookify garden tokens in Gardens v2, so we will have more freedom in the future to do multi-token gardens, and use garden tokens in multiple gardens.
This pull requests modifies the Voting Aggregator to make it a token manager hook (registrable for many Hooked Token Managers as seen below) and send the events to the hook it is plugging (such as Conviction Voting).
Each time any of the garden tokens is transferred, the voting aggregator
onTransfer
hook is going to be called, calling at once the plugged hook'sonTransfer
hook with an amount weighted by the voting aggregator configuration.Note that in order to use this feature all power sources in the voting aggregator must register it as a hook. Once a hook has been plugged in, no power sources can be added, enabled, or disabled, or their weights can change until the hook is not removed. This is done to prevent unintended effects.
To do: