Ali3NDaily Uniswap Stats During FTX Collapse by FTX Outflowers
    Updated 2022-11-16
    with ftxtable as (
    select *
    from ethereum.core.dim_labels
    where label ilike '%ftx%' or address_name ilike '%ftx%'),
    Outflowt as (
    select block_timestamp,
    to_address as receiver
    from ethereum.core.ez_token_transfers
    where from_address in (select distinct address from ftxtable)
    and to_address not in (select distinct address from ftxtable)
    and block_timestamp > CURRENT_DATE - 14
    union ALL
    select block_timestamp,
    eth_to_address as receiver
    from ethereum.core.ez_eth_transfers
    where eth_from_address in (select distinct address from ftxtable)
    and Eth_to_address not in (select distinct address from ftxtable)
    and block_timestamp > CURRENT_DATE - 14)

    select t1.block_timestamp::date as date,
    case when date >= '2022-11-08' then 'After FTX Collapse'
    else 'Before Collapse' end as timespan,
    count (distinct tx_hash) as Swaps_Count,
    count (distinct recipient) as Swappers_Count,
    abs (sum (amount0_usd)) as Total_Volume,
    abs (avg (amount0_usd)) as Average_Volume
    from ethereum.uniswapv3.ez_swaps t1 join Outflowt t2 on t1.recipient = t2.receiver and t1.block_timestamp > t2.block_timestamp
    where t1.block_timestamp >= CURRENT_DATE - 14
    group by 1,2
    order by 1
    Run a query to Download Data