MoeOverall Fee Stats copy copy
    Updated 2023-03-30
    -- forked from 5043f75f-1518-40b7-ad75-bf7017486a99

    -- forked from bd0042af-ced9-42c1-ba56-ec70fb5d437f

    with
    prc as (
    select
    date(hour)::date date,
    avg(PRICE) as price
    from
    ethereum.core.fact_hourly_token_prices
    where
    SYMBOL ilike 'wavax'
    group by
    1
    )
    select
    date_trunc({{Granularity}}, block_timestamp)::date as date,
    count(distinct TX_hash) as "tx_count ",
    round(sum(GAS_USED ),2) as "GAS_USED",
    avg(gas_price) avg_gas_price,
    count(distinct FROM_ADDRESS) as "wallets ",
    round(sum(tx_FEE * price),2) as "tot_fees $",
    round(avg(tx_FEE * price),2) as "avg_fees $",
    round(median(tx_FEE * price),2) as "median_fees $",
    round(max(tx_FEE * price),2) as "max_fees $"
    from
    avalanche.core.fact_transactions t,
    avalanche.core.dim_labels l,
    prc p
    where
    t.TO_ADDRESS = l.address
    and date = block_timestamp::date
    and block_timestamp >= current_date - {{days_back}}
    and LABEL_TYPE = 'dapp'
    Run a query to Download Data