MoDeFi#LilNouns Q1- Voting Activity 1
Updated 2022-06-21Copy Reference Fork
99
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
›
⌄
with votes as (
select BLOCK_TIMESTAMP::date as date, EVENT_INPUTS:proposalId as proposalId, EVENT_INPUTS:voter as voter,
EVENT_INPUTS:votes as votes, EVENT_INPUTS:reason as reason
from ethereum.core.fact_event_logs
where CONTRACT_ADDRESS = '0x5d2c31ce16924c2a71d317e5bbfd5ce387854039' and EVENT_NAME='VoteCast'),
holders as (
select holder, count(TOKENID) as nft_count
from
(select TOKENID, NFT_TO_ADDRESS as holder
from
(select TOKENID, NFT_TO_ADDRESS, BLOCK_NUMBER,
row_number() over (partition by TOKENID order by BLOCK_NUMBER desc) as rank
from ethereum.core.ez_nft_transfers
where NFT_ADDRESS='0x4b10701bfd7bfedc47d50562b76b436fbb5bdb3b'
order by TOKENID)
where rank=1)
group by holder
),
gas_price as (
select BLOCK_TIMESTAMP::date as date, avg(GAS_PRICE) as GAS_PRICE
from ethereum.core.fact_transactions
where date>='2020-12-23'
group by date),
results as (
select *,
case
when nft_count<3 then '1) [1 - 2] NFT'
when nft_count>=3 and nft_count<10 then '2) [3 - 9] NFT'
when nft_count>=10 and nft_count<20 then '3) [10 - 19] NFT'
else '4) [20 - ...] NFT'
end as tag
from
(select a.*, ifnull(nft_count, votes) as nft_count
Run a query to Download Data