alirsnyk-03
    Updated 2022-11-19
    WITH FTX
    AS (
    SELECT address_name
    ,label
    ,address
    FROM ethereum.core.dim_labels
    WHERE address_name ilike '%ftx%'
    OR label ilike '%ftx%'
    OR label ilike '%alameda research%'
    )
    select initcap (label) as Destination,
    count (distinct tx_hash) as TX_Count,
    sum (amount_usd) as Outflow_Volume
    from ethereum.core.ez_token_transfers trans join ethereum.core.dim_labels lab on trans.to_address = lab.address
    where from_address in (select distinct address from ftx)
    and to_address not in (select distinct address from ftx)
    and block_timestamp > CURRENT_DATE - 7
    group by 1

    union ALL

    select initcap (label) as Destination,
    count (distinct tx_hash) as TX_Count,
    sum (amount_usd) as Outflow_Volume
    from ethereum.core.ez_eth_transfers trans join ethereum.core.dim_labels lab on trans.eth_to_address = lab.address
    where eth_from_address in (select distinct address from ftx)
    and Eth_to_address not in (select distinct address from ftx)
    and block_timestamp > CURRENT_DATE - 7
    group by 1
    order by 2 desc
    limit 10




    Run a query to Download Data