m0rt3zaSushi Weekly active users - ETH vs. OP
    Updated 2022-10-26
    WITH wau_eth as (
    SELECT
    ORIGIN_FROM_ADDRESS as user,
    date_trunc('Week', block_timestamp) as week,
    COUNT(DISTINCT tx_hash) as tx_count,
    count(DISTINCT block_timestamp::date) as active_day
    FROM ethereum.sushi.ez_swaps
    WHERE block_timestamp > '2022-06-01'
    GROUP BY 1,2
    HAVING active_day > 3
    ), wau_op as (
    SELECT
    ORIGIN_FROM_ADDRESS as user,
    date_trunc('Week', block_timestamp) as week,
    COUNT(DISTINCT tx_hash) as tx_count,
    count(DISTINCT block_timestamp::date) as active_day
    FROM optimism.sushi.ez_swaps
    WHERE block_timestamp > '2022-06-01'
    GROUP BY 1,2
    HAVING active_day > 3
    ), eth_count as (
    SELECT count(DISTINCT origin_from_address) as total_count
    FROM ethereum.sushi.ez_swaps
    WHERE block_timestamp > '2022-06-01'
    ), op_count as (
    SELECT count(DISTINCT origin_from_address) as total_count
    FROM optimism.sushi.ez_swaps
    WHERE block_timestamp > '2022-06-01'
    )
    SELECT
    'Ethereum' as "Network",
    COUNT(DISTINCT user) as wau_count,
    sum(tx_count) as "Number of Transactions (By Active Users)",
    (SELECT total_count FROM eth_count) as total_users,
    (wau_count/total_users) * 100 as wau_ratio
    FROM wau_eth
    Run a query to Download Data