-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpull_snapshot_data.R
47 lines (37 loc) · 1.21 KB
/
pull_snapshot_data.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#' This query identifies Snapshot activity and NFT projects minted for specific
#' set of ~2,000 addresses for talentDAO's reputation score purposes.
# get your own API Key for free at: https://sdk.flipsidecrypto.xyz/shroomdk
api_key <- readLines("data/api_key.txt")
library(shroomDK)
voter_index_query <-
c("
SELECT
voter,
space_id
FROM
external.snapshot.ez_snapshot
WHERE
external.snapshot.ez_snapshot.space_id = 'banklessvault.eth'
")
voter_index <- shroomDK::auto_paginate_query(voter_index_query, api_key = api_key)
alist <- (paste0(tolower(unique(voter_index$voter)), collapse = "','"))
#Snapshot activity
# set to 2023-01-28 end time to replicate existing network article from talentdao newsletter
snapshot_query <-
c("
SELECT
voter,
proposal_id,
proposal_title,
voting_power,
space_id
FROM
external.snapshot.ez_snapshot
WHERE
external.snapshot.ez_snapshot.voter IN ('ADDRESSLIST')
")
# swap parameters
snapshot_query <- gsub('ADDRESSLIST', replacement = alist, x = snapshot_query)
voter_snapshots <- shroomDK::auto_paginate_query(snapshot_query, api_key = api_key)
write.csv(snapshots, file = "votes_by_voter.csv", row.names = FALSE)
write.csv(nftmints, file = "nft_mints_by_TO_ADDRESS.csv", row.names = FALSE)