binhachonMost Common Transactions - #3
Updated 2022-06-25
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 metamask_users as (
select
distinct origin_from_address
from ethereum.core.fact_event_logs
where contract_address = lower('0x881D40237659C251811CEC9c364ef91dC08D300C')
),
total_users as (
select
count(*) as total_number
from metamask_users
),
top_contracts as (
select
contract_address,
count(distinct origin_from_address) as frequency,
row_number() over (order by frequency desc) as rank
from ethereum.core.fact_event_logs
where origin_from_address in (select origin_from_address from metamask_users)
and contract_address != lower('0x881D40237659C251811CEC9c364ef91dC08D300C')
group by 1
order by 2 desc
limit 10
),
top_actions as (
select
contract_address,
event_name,
count(distinct origin_from_address) as frequency
from ethereum.core.fact_event_logs
where origin_from_address in (select origin_from_address from metamask_users)
and contract_address in (select contract_address from top_contracts)
group by 1, 2
qualify row_number() over (partition by contract_address order by frequency desc) = 1
)
select
top_actions.*,
Run a query to Download Data