MLDZMNhack5
    Updated 2022-07-28
    with tb1 as (select
    distinct USER_ADDRESS as whale,
    BALANCE
    from flipside_prod_db.ethereum.erc20_balances
    where CONTRACT_ADDRESS='ETH'
    and BALANCE_DATE=CURRENT_DATE-2
    and LABEL is null
    and AMOUNT_USD>=40000
    group by 1,2
    order by 2 desc
    )

    select
    Label,
    count(distinct tx_hash) as applic,
    sum(ETH_VALUE) as ETH
    from ethereum.core.fact_transactions x join Ethereum.core.dim_labels y on x.TO_ADDRESS= y.address
    where BLOCK_TIMESTAMP between '2022-05-01' and '2022-07-01'
    and FROM_ADDRESS in (select whale from tb1)
    and label_subtype != 'token_contract'
    and LABEL_TYPE='dex'
    group by 1
    Run a query to Download Data