gnosisguild / zodiac

A library for composable tooling for onchain entities

Home Page:https://gnosisguild.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Monitoring] - More than one answer for a proposal question at Reality.eth

juliopavila opened this issue · comments

Is your feature request related to a problem? Please describe.
More than one answer for a proposal question at Reality.eth

Describe the solution you'd like
We should first focus on sending a notification on every new answer.
We probably need a new sentinel and autotask triggered every time a LogNewQuestion is emitted where the user value is one of the Reality Modules (this new autotask must be given the question ID of the new question).
That autotask must create a sentinel that sends notifications on LogNewAnswer events for the question ID.

This requires #97

In detail:
For what we are working on in https://github.com/gnosis/zodiac/pull/91, the on_module_factory_events autotask will execute every time a new Reality Module is created.

What we now need is for this autotask, on_module_factory_events, to set up a new autotask (ProposalQuestionCreated-autotask) (and sentinel to trigger it) that will be triggered by ProposalQuestionCreated events from the Reality Module that created this autotask (the address of the Reality Module must be added to the new autotask via readFileAndReplace so that the correct filters can be added to the sentinel). You can see an example of how this can be done here: https://github.com/gnosis/zodiac-safe-app/blob/master/packages/backend/lib/defender/autotasks/on_new_question_from_module.ts / https://github.com/gnosis/zodiac-safe-app/blob/master/packages/backend/lib/defender/index.ts.

The ProposalQuestionCreated-autotask needs to set up a sentinel that sends a notification to Discord when a new LogNewAnswer event is emitted with the question ID from ProposalQuestionCreated event above. See here how: https://github.com/gnosis/zodiac-safe-app/blob/268b668f89af40e9d455efdc6078d0b19ba63be5/packages/backend/lib/defender/autotasks/on_new_question_from_module.ts#L28-L96

Overview

on_module_factory_events-autotask
Trigger: a new Reality Module it set up
Execution: setts up the ProposalQuestionCreated-autotask

ProposalQuestionCreated-autotask
Trigger: a new question from the Reality Module that created this autotask
Execution: sets up a sentinel that notifies about LogNewAnswer events from Reality.eth that matches the question ID.

This way, we get a notification in Discord for all LogNewAnswer events that are related to Reality Modules.