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

Use voting aggregator to aggregate token manager hooks as well #2

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sembrestels
Copy link
Member

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:

single-token-conviction

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).

multi-token-conviction

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's onTransfer 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:

  • Write tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant