maybeyonaslido_top5_act_transfer
Updated 2022-06-01
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
›
⌄
with
top5 as (
select
user_address,
balance
from ethereum.erc20_balances
where contract_address = '0x5a98fcbea516cf06857215779fd812ca3bef1b32'
and user_address != '0x3e40d73eb977dc6a537af587d48316fee66e9c8c' -- lido treasury
and balance_date = current_date
order by balance desc
limit 5
)
select
block_timestamp,
tx_hash,
user_address,
case when event_inputs:"from"::string = t.user_address then event_inputs:"to"::string else event_inputs:"from"::string end as other_address,
case when event_inputs:"from"::string = t.user_address then 'transfer_out' else 'transfer_in' end as direction,
event_inputs:"from"::string as from_addr,
event_inputs:to::string as to_addr,
event_inputs:value/pow(10,18) as amt
from ethereum_core.fact_event_logs f join top5 t
on f.event_inputs:"from"::string = t.user_address or f.event_inputs:to::string = t.user_address
where contract_address = '0x5a98fcbea516cf06857215779fd812ca3bef1b32'
and event_name = 'Transfer'
-- and (
-- event_inputs:from::string in (select user_address from top5)
-- or
-- event_inputs:to::string in (select user_address from top5)
-- )
limit 100
Run a query to Download Data