scottincryptoSushiswap Dex Users UNI Proportion
    Updated 2021-12-22
    with uni_users as (
    select
    from_address,
    case
    when platform in ('uniswap-v2', 'uniswap-v3') then 'uniswap'
    when platform in ('sushiswap') then 'sushiswap'
    else 'other dex'
    end as dex
    from
    ethereum.dex_swaps
    where block_timestamp > '2021-01-01'
    -- and platform in ('uniswap-v2', 'uniswap-v3')
    group by 1,2
    ),

    date_list as (
    SELECT DATEADD(week, (number - 1), '2021-01-01') AS date
    FROM (
    SELECT ROW_NUMBER() OVER (
    ORDER BY n.block_id
    )
    FROM ethereum.events_emitted n
    ) S(number)
    WHERE number <= (DATEDIFF(week, '2021-01-01', '2021-07-07') + 1)
    ),
    usd_bal_split as(
    select
    balance_date,
    case
    when symbol = 'UNI' then 'UNI'
    else 'Other Token'
    end as token_type,
    -- symbol,
    -- contract_label,
    sum(amount_usd) as usd_balance
    Run a query to Download Data