nitsPrizes
Updated 2022-06-23Copy 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
›
⌄
with usdc as
(
SELECT *, event_inputs:amount/pow(10,6) as amt, event_inputs:token as ctr, event_inputs:winner as addr, 'usdc' as type from ethereum.core.fact_event_logs
where contract_address ilike '0xde9ec95d7708B8319CCca4b8BC92c0a3B70bf416' and event_name = 'Awarded' and block_timestamp >= CURRENT_DATE -60 ),
dai as (
SELECT *, event_inputs:amount/pow(10,18) as amt, event_inputs:token as ctr, event_inputs:winner as addr , 'dai' as type from ethereum.core.fact_event_logs
where contract_address ilike '0xEBfb47A7ad0FD6e57323C8A42B2E5A6a4F68fc1a' and event_name = 'Awarded' and block_timestamp >= CURRENT_DATE -60 ),
uni as (
SELECT *, event_inputs:amount/pow(10,18)*5.1 as amt, event_inputs:token as ctr, event_inputs:winner as addr, 'uni' as type from ethereum.core.fact_event_logs
where contract_address ilike '0x0650d780292142835F6ac58dd8E2a336e87b4393' and event_name = 'Awarded' and block_timestamp >= CURRENT_DATE -60 ),
comp as (
SELECT *, event_inputs:amount*41 as amt, event_inputs:token as ctr, event_inputs:winner as addr, 'comp' as type from ethereum.core.fact_event_logs
where contract_address ilike '0xbc82221e131c082336cf698f0ca3ebd18afd4ce7' and event_name = 'Awarded' and block_timestamp >= CURRENT_DATE -60 )
SELECT date(block_timestamp) as day, type, COUNT(DISTINCT addr) as total_addresses ,
sum( total_addresses) over (partition by type order by day) as cumulative_addresses,
sum(amt) as total_amt ,
sum( total_amt ) over (partition by type order by day) as cumulative_amt from
(SELECT * from usdc
UNION ALL
SELECT * FROM dai
UNION ALL
SELECT * FROM comp
UNION ALL
SELECT * from uni )
GROUP by 1,2
limit 500
Run a query to Download Data