Hessishourn2_ fees
    Updated 2025-02-01
    -- forked from ourn_ fees @ https://flipsidecrypto.xyz/edit/queries/ae6ee554-2070-492d-bd1f-8872d23a5d6d

    -- forked from loot - fees @ https://flipsidecrypto.xyz/edit/queries/a8802fb3-eb36-4c30-8ad0-edb738456d43

    with

    prices as (SELECT HOUR::date as datex ,
    case
    when symbol = 'WETH' then '0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7'
    end as addy,
    case when symbol = 'WETH' then 'ETH' else SYMBOL end as token,
    DECIMALS , avg(PRICE) as pr
    from crosschain.price.ez_prices_hourly
    where HOUR::date >= '2021-06-01'
    and SYMBOL = 'WETH' --in ('USDT','USDC','DAI','WBTC','WETH','wstETH','rETH','LORDS')
    and BLOCKCHAIN = 'ethereum'
    GROUP by 1,2,3,4) ,


    l1 as (SELECT date_trunc('day',BLOCK_TIMESTAMP::date) as date2, avg(GAS_PRICE) as l1g
    FROM ethereum.core.fact_transactions
    where BLOCK_TIMESTAMP::date >= '2021-06-01'
    GROUP by 1
    ),

    final as (SELECT date_trunc('day',TIMESTAMP::date) as datex , sum(ACTUAL_FEE/1e18) as "Fees in $ETH", l1g,
    "Fees in $ETH"*avg(pr) as "Fees in $USD", tx_hash ,
    "Fees in $USD"/count(DISTINCT tx_hash) as "avg tx fee in $USD"
    --"Fees in $ETH"/count(DISTINCT tx_hash) as "avg tx fee in $ETH"
    from external.tokenflow_starknet.decoded_transactions
    join prices on datex=TIMESTAMP::date
    join l1 on date2=TIMESTAMP::date
    where
    TIMESTAMP >= '{{Starting_date}}'
    and TIMESTAMP <= '{{Ending_date}}'
    and CHAIN_ID = 'mainnet'
    Last run: 3 months ago
    DATE
    fees in $USD
    fees in $ETH
    avg tx fee in $USD
    avg tx fee in $ETH
    Avg L1 gas price (gwei)
    1
    2023-06-26 00:00:00.000421480.287715632224.0093130.37867521960.00020125917725.579450465
    2
    2023-12-11 00:00:00.000776015.77281219347.6106070.86397153050.00038700974749.409657968
    3
    2022-02-07 00:00:00.000000094.440380993
    4
    2022-11-21 00:00:00.00021790.39743035918.6375420.15558457340.00013307302115.783476265
    5
    2024-01-01 00:00:00.000501933.066600721221.3197030.51558260040.00022733825624.566975977
    6
    2022-12-19 00:00:00.00020445.70539111416.904170.19858296970.00016418510517.153266114
    7
    2022-07-25 00:00:00.0003765.9687192242.4751610.39196177340.00025761459219.349279703
    8
    2022-04-25 00:00:00.0000000115.746228884
    9
    2022-01-24 00:00:00.0000000138.247716347
    10
    2023-03-13 00:00:00.000124814.21629436271.4532320.40246681570.00023040287926.0601093
    11
    2022-10-17 00:00:00.00018902.30319951214.5283460.34091373950.00026202694527.008560663
    12
    2022-03-21 00:00:00.000000044.554299883
    13
    2023-02-13 00:00:00.00039045.44300837424.0760060.51018453730.00031458744140.33521346
    14
    2021-12-06 00:00:00.000000087.971026094
    15
    2023-04-03 00:00:00.000475754.598835748256.0122980.50212309080.00027020166829.617286819
    16
    2021-11-22 00:00:00.0000000126.769215312
    17
    2021-12-13 00:00:00.000000088.045609685
    18
    2022-04-04 00:00:00.000000066.11070316
    19
    2022-01-10 00:00:00.0000000175.08198785
    20
    2023-02-20 00:00:00.00044441.03425002327.0299490.51549145990.00031353248433.057354764
    ...
    116
    10KB
    81s