MoDeFiVelodrome Health 2
    Updated 2022-11-17
    with velo_txs as (select date_trunc(day, a.BLOCK_TIMESTAMP) as date, a.FROM_ADDRESS as user, TX_FEE as FEE, TX_FEE*b.PRICE as FEE_USD
    from optimism.core.fact_transactions a
    left join optimism.core.fact_hourly_token_prices b
    on b.TOKEN_ADDRESS is null and date_trunc(hour, a.BLOCK_TIMESTAMP)=date_trunc(hour, b.HOUR)
    where TX_HASH in (
    select tx_hash from optimism.velodrome.ez_claimed_rewards
    union
    select tx_hash from optimism.velodrome.ez_gauges
    union
    select tx_hash from optimism.velodrome.ez_lp_actions
    union
    select tx_hash from optimism.velodrome.ez_staking_actions
    union
    select tx_hash from optimism.velodrome.ez_swaps
    union
    select tx_hash from optimism.velodrome.ez_velo_locks
    union
    select tx_hash from optimism.velodrome.ez_votes)
    )

    select date_trunc(day, min_date) as date, count(distinct user) as new_users,
    sum(new_users) over (order by date) total_users
    from
    (select user, min(date) as min_date
    from velo_txs
    group by 1)
    group by 1

    Run a query to Download Data