select
project_name as "dApp",
count(x.tx_hash) as "Total fees",
avg(tx_fee) as "Average txn fee"
from avalanche.core.fact_transactions x join avalanche.core.fact_event_logs y on x.tx_hash = y.tx_hash
join avalanche.core.dim_contracts z on y.contract_address = z.address
where x.block_timestamp >= '{{From_Date}}'
and x.block_timestamp <= '{{To_Date}}'
and project_name is not null
GROUP BY 1
ORDER BY 2 DESC
LIMIT 10