eferPolygon Fees 2022
    Updated 2023-04-12
    WITH variables AS (
    SELECT
    '2022-06-06' AS START_DATE
    ), polygon_fees AS (
    SELECT
    BLOCK_TIMESTAMP::date AS date,
    SUM(TX_FEE) AS polygon_daily_paid_fees,
    AVG(GAS_LIMIT) AS polygon_average_gas_limit,
    AVG(GAS_PRICE) AS polygon_average_gas_price,
    SUM(polygon_daily_paid_fees) OVER(ORDER BY date ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS polygon_cumulative,
    COUNT(*) AS polygon_count
    FROM polygon.core.fact_transactions
    WHERE date >= (SELECT START_DATE FROM variables)
    AND TX_FEE is NOT NULL
    AND STATUS = 'SUCCESS'
    GROUP BY date
    ), eth_fees AS (
    SELECT
    BLOCK_TIMESTAMP::date AS date,
    SUM(TX_FEE) AS eth_daily_paid_fees,
    AVG(GAS_LIMIT) AS eth_average_gas_limit,
    AVG(GAS_PRICE) AS eth_average_gas_price,
    SUM(eth_daily_paid_fees) OVER(ORDER BY date ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS eth_cumulative,
    COUNT(*) AS eth_count
    FROM ethereum.core.fact_transactions
    WHERE date >= (SELECT START_DATE FROM variables)
    AND TX_FEE is NOT NULL
    AND STATUS = 'SUCCESS'
    GROUP BY date
    )


    SELECT
    polygon.date,
    polygon.polygon_daily_paid_fees,
    eth.eth_daily_paid_fees,
    Run a query to Download Data