With revenue AS (SELECT
a.block_timestamp as block_timestamp,
a.Tx_hash as Tx_hash,
a.gas_price as gas_price,
a.gas_used as gas_used,
a.tx_fee as tx_fee,
b.platform as platform
from ethereum.core.fact_transactions a
Join ethereum.core.ez_dex_swaps b
On a.tx_hash = b.tx_hash)
SELECT date_trunc('Month', block_timestamp) AS date,
SUM(gas_used) AS total_gas_used,
SUM(tx_fee) AS total_gas_fee
FROM revenue
WHERE platform = 'uniswap-v3'
AND date >= CURRENT_DATE - INTERVAL '1 year'
GROUP BY 1
ORDER BY 1, 3 DESC;