mlhUntitled Query
Updated 2022-08-01Copy 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
›
⌄
with bridge as (
select BLOCK_TIMESTAMP,
EVENT_INPUTS:to as users
from polygon.core.fact_event_logs
where EVENT_NAME='Transfer'
and ORIGIN_TO_ADDRESS='0x0000000000000000000000000000000000000000'
and ORIGIN_TO_ADDRESS = ORIGIN_FROM_ADDRESS
),
des as (
select x.BLOCK_TIMESTAMP,
x.tx_hash,
x.TO_ADDRESS,
x.FROM_ADDRESS,
ROW_NUMBER() OVER (partition by FROM_ADDRESS order by x.BLOCK_TIMESTAMP) as actions
from polygon.core.fact_token_transfers x
join bridge y on x.from_address = y.users
and x.block_timestamp>y.block_timestamp
and from_address != '0x0000000000000000000000000000000000000000'
order by 1
)
select distinct PROJECT_NAME as project,
count(tx_hash) as trxs,
count(distinct FROM_ADDRESS) as users
from des q join polygon.core.dim_labels w on q.TO_ADDRESS= w.address
where LABEL_TYPE not in ('chadmin','operator')
and label_subtype != 'token_contract'
and actions=1
and PROJECT_NAME !='hop protocol'
group by 1
order by 2 desc
limit 10
Run a query to Download Data