0xHaM-dLunaRune Mint Txs fees Over Time
    Updated 2023-12-30
    with lst_luna_price as (
    select
    hour as price_date
    ,median(price) as avg_price
    from crosschain.price.ez_hourly_token_prices
    where SYMBOL ilike 'luna'
    and blockchain = 'cosmos'
    and price_date < current_date
    group by 1
    order by 1
    )
    ,lst_fee as (
    select
    tx_id
    ,to_number(split(attribute_value, 'uluna')[0])/1e6 as S_Fee
    from terra.core.fact_msg_attributes_standard
    where attribute_value ilike '%uluna'
    and msg_type = 'tx'
    and attribute_key = 'fee'
    )

    SELECT
    date_trunc('hour' , block_timestamp) as date,
    CASE
    when block_timestamp::date = '2023-12-28' then 'Attacks Date' else 'Other Date' end as date_type,
    -- execut.ATTRIBUTE_VALUE as executer_address,
    count(DISTINCT tx_id) as mints,
    count(DISTINCT tx_sender) as minters,
    sum(S_Fee) as "LUNA_FEE",
    sum(S_Fee*avg_price) as "USD_FEE"
    from terra.core.fact_transactions t
    join lst_fee using(tx_id)
    join lst_luna_price on price_date = date_trunc('hour' , block_timestamp)
    JOIN terra.core.fact_msg_attributes_standard mint using(BLOCK_TIMESTAMP, TX_ID)
    -- JOIN terra.core.fact_msg_attributes_standard execut using(BLOCK_TIMESTAMP, TX_ID)
    WHERE block_timestamp::date >= '2023-12-25'
    QueryRunArchived: QueryRun has been archived