adriaparcerisasSushi noobs II
    Updated 2022-06-22
    WITH
    new_users as (
    SELECT
    distinct origin_from_address as user,
    min(block_timestamp) as first_acquisition
    from ethereum.core.ez_dex_swaps
    where symbol_out='SUSHI' AND amount_out>0
    group by 1
    ),
    final_data as (
    SELECT
    distinct origin_from_address as user,
    min(block_timestamp) as first_tx_after_sushi
    from ethereum.core.fact_event_logs x
    join new_users y on x.origin_from_address=y.user
    and x.block_timestamp>y.first_acquisition
    group by 1
    )
    SELECT
    --origin_function_signature
    distinct event_name,
    count(distinct tx_hash) as counts
    from ethereum.core.fact_event_logs x
    join final_data y
    on x.origin_from_address=y.user
    and x.block_timestamp=y.first_tx_after_sushi
    and event_name is not null
    group by 1
    order by 2 desc


    Run a query to Download Data