bachiAvalanche 10
    Updated 2023-04-13
    WITH nft_details
    AS (SELECT b.tx_hash,
    a.project_name,
    b.origin_to_address,
    c.tx_fee,
    a.address,
    a.label_type,
    (gas_price * gas_used) AS gas_fee
    FROM avalanche.core.dim_labels a
    INNER JOIN avalanche.core.fact_event_logs b
    ON b.contract_address = a.address
    INNER JOIN avalanche.core.fact_transactions c
    ON b.tx_hash = c.tx_hash)
    SELECT project_name,
    Count(DISTINCT tx_hash) AS total_txs_count,
    Count(DISTINCT origin_to_address) AS no_of_users,
    Count(DISTINCT address) AS no_of_nfts_sold,
    Round(Sum(tx_fee), 2) AS total_txn_fees,
    Round(avg(gas_fee), 2) AS avg_gas_fees
    FROM nft_details
    WHERE label_type = 'nft'
    GROUP BY project_name
    ORDER BY total_txn_fees DESC
    limit 10
    Run a query to Download Data