banterlyticsVX combined 30
Updated 2022-12-02
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
›
⌄
with all_tx as (
select date_trunc('day', block_timestamp::date) as dt,
tx_hash, event_inputs:to::string as event_to,
event_inputs:from::string as event_from, event_inputs:tokenId::string as token_id
from ethereum_core.fact_event_logs
where contract_address = lower('0x7EA3Cca10668B8346aeC0bf1844A49e995527c8B')
and event_name = 'Transfer'
and block_timestamp < current_date - 30
union all
select date_trunc('day', block_timestamp::date) as dt,
tx_hash, event_inputs:to::string as event_to,
event_inputs:from::string as event_from, event_inputs:tokenId::string as token_id
from polygon.core.fact_event_logs
where contract_address = lower('0x05df72d911e52AB122f7d9955728BC96A718782C')
and event_name = 'Transfer'
and block_timestamp < current_date - 30),
transfers as
((SELECT
event_to as wallet,
dt,
'mint' as action,
1 as value
FROM all_tx
where event_from = '0x0000000000000000000000000000000000000000')
union all
(SELECT
event_to as wallet,
dt,
'gain' as action,
1 as value
FROM all_tx
where event_from != '0x0000000000000000000000000000000000000000')
union all
(SELECT
event_from as wallet,
dt,
'lose' as action,
-1 as value
FROM all_tx
where event_to != '0x0000000000000000000000000000000000000000')
union all
(SELECT
event_from as wallet,
dt,
'burn' as action,
-1 as value
FROM all_tx
where event_to = '0x0000000000000000000000000000000000000000')
),
final as (
select wallet,
sum(value) as num_primary
from transfers
group by 1
)
select count(distinct wallet) as counts
from final
where num_primary > 0
Run a query to Download Data