Query editor
-- with emission as (-- SELECT-- evt_block_date as date,-- contract_address,-- CAST(-- REDUCE(-- amounts, -- array column-- 0, -- initial value-- (s, x) -> s + x, -- lambda function to sum elements-- s -> s -- output function (identity in this case)-- ) AS DOUBLE-- ) / 1e18 AS amounts -- Normalize values-- FROM flareprotocol_flare.RNat_evt_RewardsDistributed-- )-- select-- date_trunc('month',date) as month,-- sum(amounts) as amounts-- from emission-- group by 1WITH emission AS (SELECTevt_block_date,SUM(CAST(amount AS DOUBLE) / 1e18) AS esnamountsFROM flareprotocol_flare.RNat_evt_RewardsClaimedGROUP BY 1),flare_prices as (select day, pricefrom prices.usd_dailywhere symbol='FLR'),aggregated_emission AS (SELECTdate_trunc('month',evt_block_date) as month,SUM(esnamounts) AS "Emission Amount [FLR]",SUM(esnamounts*prices.price) AS "Emission Amount [USD]"FROM emissionleft join flare_prices prices on prices.day = emission.evt_block_dateGROUP BY 1)SELECTmonth,"Emission Amount [FLR]","Emission Amount [USD]",SUM("Emission Amount [FLR]") OVER (ORDER BY month) AS "Total [FLR]",SUM("Emission Amount [USD]") OVER (ORDER BY month) AS "Total [USD]"FROM aggregated_emissionORDER BY month desc