Query editor
with transaction_gas_used_cum as (with transaction_gas_used as (select date_trunc('day', block_time) as blockTimestamp,count(*) as transactionCount,avg(gas_used) as gasAvg,sum(gas_used) as gasSum,avg(gas_price) / 1e9 as gasPriceAvg,avg(gas_price / 1e18 * p.price) as gasPriceAvgUsd,avg(gas_used / 1e18 * gas_price) as transactionFeeAvg,avg(gas_used / 1e18 * gas_price * p.price) as transactionFeeAvgUsd,sum(gas_price / 1e18 * gas_used) as transactionFeeSum,sum(gas_price / 1e18 * gas_used * p.price) AS transactionFeeSumUsdFROM fantom.transactions tLEFT JOIN prices.usd AS pON date_trunc('minute', t.block_time) = p.minuteAND p.contract_address = 0x4e15361fd6b4bb609fa63c81a2be19d873717870where ("to" = 0xeF4B763385838FfFc708000f884026B8c0434275 or "from" = 0x0a252663DBCc0b073063D6420a40319e438Cfa59)group by date_trunc('day', block_time))select *,sum(transactionFeeSum) over (order by blockTimestamp rows unbounded preceding) as transactionFeeSumCumulative,sum(transactionFeeSumUsd) over (order by blockTimestamp rows unbounded preceding) as transactionFeeSumUsdCumulative,(select 'ftm') as currency,(select 'fantom') as network,(select 'xen') as contractfrom transaction_gas_usedwhere blockTimestamp >= from_iso8601_timestamp('2022-10-06')order by blockTimestamp desc)select * from transaction_gas_used_cum where blockTimestamp >= date_trunc('day', now() - interval '7' day)