grant-hub icon indicating copy to clipboard operation
grant-hub copied to clipboard

project stats: determine if we can pull project stats data from Round Manager

Open michellema1208 opened this issue 2 years ago • 1 comments

Problem: We want to know if we can get the following project stats from Round Manager:

  • est. funding received
  • average contribution amount
  • unique contributors
  • number of contributions
  • number of rounds participated in
  • all contributions - wallet address/ENS, time donated, amount donated

Notes from Andrea <> Aditya chat:

what they have - by round and project / or by project - earning for current round - current contributions - total usd contributions - number of contributions - list of contributions

michellema1208 avatar Jan 06 '23 14:01 michellema1208

Data sources, see discussion on discord.

API endpoints

https://api-server/api/v1/data/summary/project/:chainId/:roundId/:projectId

example: curl -X GET -H "Content-Type: application/json" -d '{"query": "force"}' https://api-server/api/v1/data/summary/project/1/0xdf75054cd67217aee44b4f9e4ebc651c00330938/0x39D77e51c485F1ff65b1b3B42e9f67CdA221F597

returns:

{
   "success":true,
   "message":"/api/v1/data/summary/project/1/0xdf75054cd67217aee44b4f9e4ebc651c00330938/0x39D77e51c485F1ff65b1b3B42e9f67CdA221F597",
   "data":{
      "id":2,
      "createdAt":"2023-01-11T10:58:06.859Z",
      "updatedAt":"2023-01-11T10:58:06.859Z",
      "contributionCount":0,
      "uniqueContributors":0,
      "totalContributionsInUSD":0,
      "averageUSDContribution":0,
      "projectId":"0x39D77e51c485F1ff65b1b3B42e9f67CdA221F597"
}

or update and get data: https://api-server/api/v1/update/summary/project/:chainId/:roundId/:projectId example: curl -X POST -H "Content-Type: application/json" -d '{"query": "force"}' https://<api-server>/api/v1/update/summary/project/1/0xdf75054cd67217aee44b4f9e4ebc651c00330938/0x39D77e51c485F1ff65b1b3B42e9f67CdA221F597 returns:

{
   "success":true,
   "message":"/api/v1/update/summary/project/1/0xdf75054cd67217aee44b4f9e4ebc651c00330938/0x39D77e51c485F1ff65b1b3B42e9f67CdA221F597",
   "data":{
      "id":2,
      "createdAt":"2023-01-11T10:58:06.859Z",
      "updatedAt":"2023-01-11T10:58:06.859Z",
      "contributionCount":0,
      "uniqueContributors":0,
      "totalContributionsInUSD":0,
      "averageUSDContribution":0,
      "projectId":"0x39D77e51c485F1ff65b1b3B42e9f67CdA221F597"
   }
}

project data for one specific round:

  • est. funding received: data.totalContributionsInUSD

  • average contribution amount: data.averageUSDContribution

  • number of contributions: data.contributionCount

  • unique contributors: data.uniqueContributors

  • rounds and number of rounds participated in: - already implemented (see Details page)

  • totalContributionsInUSD and uniqueContributors of a project across all chains for the past and current rounds: can be calculated on frontend

  • all contributions - wallet address/ENS, time donated, amount donated: get project payoutAddress from round.projectMetaPtr get the votingStrategy from round query subgraph:

{
  qfvotes(where: {to_contains_nocase: "<payoutAddress>", votingStrategy_contains_nocase: "<votingStrategy>"}
    orderBy: createdAt
    orderDirection: desc
    first: 10
) {
    amount
    from
    to
    createdAt
    token
  }
}

returns:

{
  "data": {
    "qfvotes": [
      {
        "amount": "1200000000000000",
        "from": "0x3803431f81fde7239c6947b09bdc02a8beac6ebc",
        "to": "0x95d34596db5a2f65f2a92b97955bf7920fd1c9e3",
        "createdAt": "1671399095",
        "token": "0x0000000000000000000000000000000000000000"
      },
      {
        "amount": "100000000000000",
        "from": "0x8e3c555386e42890befddec001cd6dfd76adcf3e",
        "to": "0x95d34596db5a2f65f2a92b97955bf7920fd1c9e3",
        "createdAt": "1671108515",
        "token": "0x0000000000000000000000000000000000000000"
      }
    ]
  }
}

0xKurt avatar Jan 11 '23 13:01 0xKurt