Afonso_Diaztotal copy
    Updated 2024-11-01
    with

    pricet as (
    select
    hour::date as date,
    avg(price) as price_usd
    from ethereum.price.ez_prices_hourly
    where symbol = 'WETH'
    group by 1
    ),

    main as (
    select
    tx_hash,
    block_timestamp,
    from_address as user,
    tx_fee,
    tx_fee * price_usd as tx_fee_usd
    from blast.core.fact_transactions
    left join pricet on block_timestamp::date = date
    where block_timestamp >= '{{ start_date }}'
    and block_timestamp <= '{{ end_date }}'
    and status = 'SUCCESS'
    )

    select
    count(distinct tx_hash) as transactions,
    (transactions / (select count(distinct tx_hash) from bsc.core.fact_transactions where block_timestamp <= '{{ end_date }}' and status = 'SUCCESS')) * 100 as success_rate,
    count(distinct user) as users,
    sum(tx_fee_usd) as total_fee_usd,
    avg(tx_fee_usd) as average_fee_usd,
    transactions / count(distinct block_timestamp::date) as daily_average_transactions,
    users / count(distinct block_timestamp::date) as daily_average_users
    from main

    QueryRunArchived: QueryRun has been archived