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

Voting Connector: Support vote rewards #338

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

PJColombo
Copy link

@PJColombo PJColombo commented Nov 12, 2021

This PR builds on top of #336 and addreses the DeepDao's Gitcoin bounty related to supporting vote rewards.

It adds a new functionality to the Vote model that allows you to get all the actions inside the vote script which is a set of codified DAO's app contract calls that are executed once the vote is enacted.

An action has the following fields:

  • to: The target contract address.
  • fnData: Data related to the function being called.
    -- abi: the ABI function fragment.
    -- roles: The ACL roles needed to execute the function.
    -- sig: The function signature (e.g. transfer(address,address,uint256)).
    -- params: The function parameter values.
    -- notice: The function radspec description.
  • rewards: An array containing all the action rewards. A reward has the following fields:
    -- amount: The reward's token amount.
    -- receiver: The account that receives the reward.
    -- token: The reward's token contract address.

If an action involves a token transfer from the DAO to an account then the rewards field is filled.

Right now, the following are considered to be token transfer actions:

  • Calls to the Vault/Agent's contract function transfer(address _token, address _to, uint256 _value).
  • Calls to the Finance's contract function newImmediatePayment(address _token, address _receiver, uint256 _amount, string _reference).

If you want to quickly test the connector with these changes you can use a private subgraph that I deployed just for testing: https://thegraph.com/hosted-service/subgraph/pjcolombo/connect-voting-status

You only need to change the VOTING_SUBGRAPH_URL variable value here.

@PJColombo PJColombo marked this pull request as ready for review November 12, 2021 18:22
Copy link
Contributor

@0xGabi 0xGabi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work and well done with the unit testing. Reading them made me realize that the final structure you choose for the data was the right one. I left a couple of comments and an open question about your thoughts for the getRewards function.

packages/connect-core/src/utils/app.ts Outdated Show resolved Hide resolved
@pmlambert
Copy link

@0xGabi I spent a nice chunk of time not knowing this 🥇


const VOTING_SUBGRAPH_URL =
'https://api.thegraph.com/subgraphs/name/aragon/aragon-voting-rinkeby-staging'
'https://api.thegraph.com/subgraphs/name/aragon/aragon-voting-rinkeby'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the tests did not ran successfully, even after swapping the VOTING_SUBGRAPH_URL as stated in the PR description.

  • can you provide more context or instruction how you run test locally?
  • Is there a way to run the test successfully without swapping the URL?

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

Successfully merging this pull request may close these issues.

4 participants