Abbas_ra21Saved Fee
    Updated 2022-10-19
    with tb AS (
    select date_trunc('day',BLOCK_TIMESTAMP) AS day,
    avg(TX_FEE) AS FEE from ethereum.core.fact_transactions group by 1
    )
    select
    'Arbitrum' AS CHAIN,
    date_trunc('day',BLOCK_TIMESTAMP) AS day,
    count(*) AS "TX number",
    sum(TX_FEE) AS "Fee",
    sum(Fee) AS "ETH Fee",
    "ETH Fee"-"Fee" AS "saved Fee"
    from arbitrum.core.fact_transactions A inner join tb B on date_trunc('day',BLOCK_TIMESTAMP)=B.DAY
    where day >= dateadd('month',-3,CURRENT_DATE)
    group by 2
    union ALL
    select
    'Optimism' AS CHAIN,
    date_trunc('day',BLOCK_TIMESTAMP) AS day,
    count(*) AS "TX number",
    sum(TX_FEE) AS "Fee",
    sum(Fee) AS "ETH Fee",
    "ETH Fee"-"Fee"AS "saved Fee"
    from optimism.core.fact_transactions A inner join tb B on date_trunc('day',BLOCK_TIMESTAMP)=B.DAY
    where day >= dateadd('month',-3,CURRENT_DATE)
    group by 2
    Run a query to Download Data