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 * gas_price / 1e18) as transactionFeeAvg,avg(gas_used * gas_price / 1e18 * p.price) as transactionFeeAvgUsd,sum(gas_price * gas_used / 1e18) as transactionFeeSum,sum(gas_price * gas_used / 1e18 * p.price) AS transactionFeeSumUsdFROM polygon.transactions tLEFT JOIN prices.usd AS pON date_trunc('minute', t.block_time) = p.minuteAND p.contract_address = 0xb8c77482e45f1f44de1745f52c74426c631bdd52where ("to" = 0x2AB0e9e4eE70FFf1fB9D67031E44F6410170d00e or "from" = 0x2AB0e9e4eE70FFf1fB9D67031E44F6410170d00e)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 'bnb') as currency,(select 'bsc') 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)