0-MIDfee-base-zk
    Updated 2025-01-07

    with tab1 as (
    select --BLOCK_TIMESTAMP::date as day
    TX_HASH
    from base.core.ez_decoded_event_logs
    where EVENT_NAME='LiFiTransferStarted'
    and DECODED_LOG:bridgeData:integrator='jumper.exchange'
    and ORIGIN_TO_ADDRESS='0x1231deb6f5749ef6ce6943a275a1d3e7486f4eae'
    and BLOCK_TIMESTAMP::date>=current_date-1
    and DECODED_LOG:bridgeData:destinationChainId='324'
    ),
    tab2 as (
    select BLOCK_TIMESTAMP::date as day
    ,TX_HASH
    ,TX_FEE
    ,GAS_USED
    ,GAS_PRICE as GAS_PRICE
    ,CUMULATIVE_GAS_USED
    ,MAX_FEE_PER_GAS/1e9 as max_gas_price
    from base.core.fact_transactions
    where BLOCK_TIMESTAMP::date>=current_date-1
    and STATUS='SUCCESS'
    ),
    tab3 as (
    select tab2.day as day
    ,avg(TX_FEE) as network_fee
    ,avg((CUMULATIVE_GAS_USED-GAS_USED)*GAS_PRICE) as protocol_fee
    ,avg(CUMULATIVE_GAS_USED*GAS_PRICE) as total_fee_paid
    from tab1
    left join tab2
    on tab1.TX_HASH=tab2.TX_HASH
    group by 1
    ),
    tab4 as (
    select HOUR::date as day
    ,avg(PRICE) as pric_usd
    QueryRunArchived: QueryRun has been archived