MLDZMNflow.4
    Updated 2022-08-13
    with tb1 as (SELECT
    *
    FROM Ethereum.core.dim_labels where label_type = 'cex' and label_subtype = 'hot_wallet'
    ),

    tb2 as (select
    block_timestamp,
    ORIGIN_TO_ADDRESS as u1
    from ethereum.core.ez_token_transfers
    where ORIGIN_FROM_ADDRESS in (select ADDRESS from tb1)
    and BLOCK_TIMESTAMP>=CURRENT_DATE-180
    ),


    tb3 as (
    select
    x.BLOCK_TIMESTAMP,
    x.FROM_ADDRESS,
    x.TO_ADDRESS,
    x.tx_hash,
    ROW_NUMBER() OVER (partition by FROM_ADDRESS order by x.BLOCK_TIMESTAMP) as t_n
    from ethereum.core.fact_transactions x
    join tb2 y on x.FROM_ADDRESS = y.u1 and x.block_timestamp>y.block_timestamp
    order by 1
    )

    select
    distinct event_name as first_actions,
    count(distinct tx_hash) as counts,
    count(distinct origin_from_address) as users
    from ethereum.core.fact_event_logs
    where tx_hash in (select tx_hash from tb3)
    group by 1
    having first_actions is not null
    order by 2 desc limit 10

    Run a query to Download Data