Elprognerd7 - chart of top dapp with most txn fee volume copy
    Updated 2023-03-29
    with t1 as (
    select
    project_name as "dApp",
    sum(tx_fee) as "Total fees"
    from avalanche.core.fact_transactions x join avalanche.core.fact_event_logs y on x.tx_hash = y.tx_hash
    join avalanche.core.dim_labels z on y.origin_to_address = z.address
    where x.block_timestamp >= '{{From_Date}}'
    and x.block_timestamp <= '{{To_Date}}'
    and label_type ilike 'dapp'

    GROUP BY 1
    ORDER BY 2 DESC
    LIMIT 8
    )



    select
    date_trunc('{{Time_Unit}}',x.block_timestamp) as date,
    project_name as "dApp",
    sum(tx_fee) as "Total fees"
    from avalanche.core.fact_transactions x join avalanche.core.fact_event_logs y on x.tx_hash = y.tx_hash
    join avalanche.core.dim_labels z on y.origin_to_address = z.address
    where x.block_timestamp >= '{{From_Date}}'
    and x.block_timestamp <= '{{To_Date}}'
    and label_type ilike 'dapp'
    and project_name in (SELECT "dApp" from t1)

    GROUP BY 1, 2
    ORDER BY 1





    Run a query to Download Data