Skip to content

Instantly share code, notes, and snippets.

@adamwhitakerwilson
Last active March 20, 2021 05:42
Show Gist options
  • Save adamwhitakerwilson/3f938d57bdd802657d843b3a7b1afaf2 to your computer and use it in GitHub Desktop.
Save adamwhitakerwilson/3f938d57bdd802657d843b3a7b1afaf2 to your computer and use it in GitHub Desktop.
Compound Proposal #41 Vote counts + sum using Covalent | Primer
// https://api.covalenthq.com/v1/1/address/0xc0da01a04c3f3e0be433606045bb7017a7323e38/transactions_v2/?page-number=0&page-size=10000&primer=[{"$match":{"$and":[{"log_events.0.decoded.name":"VoteCast"},{"log_events.0.decoded.params.1.value":"41"},{"log_events.0.decoded.params.2.value":true}]}},{"$group":{"_id":{"month":{"$month":"block_signed_at"},"day":{"$dayOfMonth":"block_signed_at"},"year":{"$year":"block_signed_at"},"hour":{"$hourOfDay":"block_signed_at"}},"vote_count":{"$sum":1},"sum_of_votes":{"$sum":"log_events.0.decoded.params.3.value"}}}]
{
"data": {
"address": "0xc0da01a04c3f3e0be433606045bb7017a7323e38",
"updated_at": "2021-03-20T04:59:02.364135356Z",
"next_update_at": "2021-03-20T05:04:02.364137552Z",
"quote_currency": "USD",
"chain_id": 1,
"items": [
{
"id": {
"month": 3,
"day": 17,
"year": 2021,
"hour": 10
},
"vote_count": 2,
"sum_of_votes": 90837668050707220000
},
{
"id": {
"month": 3,
"day": 17,
"year": 2021,
"hour": 5
},
"vote_count": 1,
"sum_of_votes": 5.000001736301232e+22
},
{
"id": {
"month": 3,
"day": 16,
"year": 2021,
"hour": 22
},
"vote_count": 2,
"sum_of_votes": 3772022765716426000
},
{
"id": {
"month": 3,
"day": 16,
"year": 2021,
"hour": 21
},
"vote_count": 1,
"sum_of_votes": 0
},
{
"id": {
"month": 3,
"day": 16,
"year": 2021,
"hour": 14
},
"vote_count": 1,
"sum_of_votes": 1.592473e+22
},
{
"id": {
"month": 3,
"day": 16,
"year": 2021,
"hour": 13
},
"vote_count": 1,
"sum_of_votes": 214657220000000000
},
{
"id": {
"month": 3,
"day": 16,
"year": 2021,
"hour": 11
},
"vote_count": 1,
"sum_of_votes": 28219277551755544
},
{
"id": {
"month": 3,
"day": 16,
"year": 2021,
"hour": 10
},
"vote_count": 1,
"sum_of_votes": 226698033659746270
},
{
"id": {
"month": 3,
"day": 16,
"year": 2021,
"hour": 4
},
"vote_count": 1,
"sum_of_votes": 101627400287062750000
},
{
"id": {
"month": 3,
"day": 16,
"year": 2021,
"hour": 3
},
"vote_count": 1,
"sum_of_votes": 6.510010872898223e+22
},
{
"id": {
"month": 3,
"day": 16,
"year": 2021,
"hour": 2
},
"vote_count": 6,
"sum_of_votes": 7.515814921105398e+21
},
{
"id": {
"month": 3,
"day": 16,
"year": 2021,
"hour": 0
},
"vote_count": 1,
"sum_of_votes": 38110144938082670
},
{
"id": {
"month": 3,
"day": 15,
"year": 2021,
"hour": 23
},
"vote_count": 1,
"sum_of_votes": 250000000000000000
},
{
"id": {
"month": 3,
"day": 15,
"year": 2021,
"hour": 22
},
"vote_count": 1,
"sum_of_votes": 78003030501104400000
},
{
"id": {
"month": 3,
"day": 15,
"year": 2021,
"hour": 21
},
"vote_count": 2,
"sum_of_votes": 1.0002062683560946e+23
},
{
"id": {
"month": 3,
"day": 15,
"year": 2021,
"hour": 20
},
"vote_count": 1,
"sum_of_votes": 31132464067668423000
},
{
"id": {
"month": 3,
"day": 15,
"year": 2021,
"hour": 18
},
"vote_count": 1,
"sum_of_votes": 21000017675623750000
},
{
"id": {
"month": 3,
"day": 15,
"year": 2021,
"hour": 14
},
"vote_count": 3,
"sum_of_votes": 3000835678570277400
},
{
"id": {
"month": 3,
"day": 15,
"year": 2021,
"hour": 12
},
"vote_count": 1,
"sum_of_votes": 1.0513021790523399e+23
},
{
"id": {
"month": 3,
"day": 15,
"year": 2021,
"hour": 11
},
"vote_count": 2,
"sum_of_votes": 1194305820000000000
},
{
"id": {
"month": 3,
"day": 15,
"year": 2021,
"hour": 7
},
"vote_count": 2,
"sum_of_votes": 1841094779962618600
},
{
"id": {
"month": 3,
"day": 15,
"year": 2021,
"hour": 0
},
"vote_count": 2,
"sum_of_votes": 2.1978391613762e+22
},
{
"id": {
"month": 3,
"day": 14,
"year": 2021,
"hour": 22
},
"vote_count": 9,
"sum_of_votes": 299835976517417400
}
],
"pagination": {
"has_more": false,
"page_number": 0,
"page_size": 10000,
"total_count": null
}
},
"error": false,
"error_message": null,
"error_code": null
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment