hessDaily Unique users (Metamask, Sushi, Uniswap)
    Updated 2022-06-24
    with metamask as ( select date(block_timestamp) as date , count(DISTINCT(ORIGIN_FROM_ADDRESS)) as total_users,
    sum(total_users) over (order by date asc) as cum_users, count(DISTINCT(tx_hash)) as total_swaps
    from ethereum.core.fact_token_transfers
    where ORIGIN_TO_ADDRESS = lower('0x881d40237659c251811cec9c364ef91dc08d300c')
    and ORIGIN_FROM_ADDRESS = from_address and block_timestamp::date >= '2022-01-01'
    group by 1)
    ,
    platform as ( select date(block_timestamp) as date ,platform , count(DISTINCT(ORIGIN_FROM_ADDRESS)) as total_users,
    sum(total_users) over (partition by platform order by date asc) as cum_users , count(DISTINCT(tx_hash)) as total_swaps
    from ethereum.core.ez_dex_swaps
    where block_timestamp::date >= '2022-01-01' and origin_to_address != lower('0x881d40237659c251811cec9c364ef91dc08d300c')
    and origin_from_address != lower('0x881d40237659c251811cec9c364ef91dc08d300c') and origin_to_address != lower('0xF326e4dE8F66A0BDC0970b79E0924e33c79f1915')
    and origin_from_address != lower('0xF326e4dE8F66A0BDC0970b79E0924e33c79f1915')
    group by 1,2)

    select date ,'Metamask' as type , total_users , cum_users, total_swaps
    from metamask
    UNION
    select date, 'Sushiswap' as type, total_users , cum_users, total_swaps
    from platform
    where platform = 'sushiswap'
    UNION
    select date, 'Uniswap' as type, total_users , cum_users, total_swaps
    from platform
    where platform = 'uniswap-v2'
    Run a query to Download Data