Updated 2023-03-27
    -- forked from 2e3b55fc-a16a-4595-bf30-d8f1766653bb

    with contracts_address as (select address , project_name from avalanche.core.dim_labels where label_type='token')
    , new_user_table as (select count(*) as new_users , m , project_name from (select min(block_timestamp::date) as m , from_address , project_name from avalanche.core.fact_transactions
    inner join contracts_address
    on to_address=address
    group by 2,3)
    group by 2,3
    )

    select sum(tx_fee) , sum(gas_used/1e9) ,count(distinct from_address), project_name , block_timestamp::date from avalanche.core.fact_transactions
    inner join contracts_address
    on to_address=address
    where block_timestamp::date > {{param_TPdh}} and block_timestamp::date < {{param_eRM7}}
    group by 4,5



    Run a query to Download Data