connect icon indicating copy to clipboard operation
connect copied to clipboard

Voting Connector: Support vote rewards

Open PJColombo opened this issue 2 years ago • 1 comments

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 avatar Nov 12 '21 04:11 PJColombo

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

pmlambert avatar Nov 29 '21 23:11 pmlambert