Query editor
-- Treehouse Revenue Dashboard | Benqi Rebate-- Monthly native AVAX transferred from Benqi rebate source to tAVAX treasury-- Output: month, revenue_native (AVAX), asset_symbol, chain-- Note: current month is INCLUDED here (unlike other streams) since rebates have only-- just started flowing. Revisit once historical months accumulate.WITH params AS (SELECT0x8AB0EB1314ffa9636B941E0d1c5805dec905B29a AS treasury,DATE '2025-01-01' AS start_month),sources (addr) AS (VALUES(0x3A9c976140EDE3312Ad6bD9622E810E59B885E5a),(0x5EbEbF67Dd92cF0FbdFE078cC946b7Ab291563F9))SELECTCAST(date_trunc('month', tr.block_time) AS DATE) AS month,SUM(CAST(tr.value AS DOUBLE) / 1e18) AS revenue_native,'AVAX' AS asset_symbol,'avalanche_c' AS chainFROM avalanche_c.traces trCROSS JOIN params pWHERE tr."to" = p.treasuryAND tr."from" IN (SELECT addr FROM sources)AND tr.value > UINT256 '0'AND tr.successAND tr.tx_successAND tr.block_date >= p.start_monthGROUP BY 1ORDER BY 1 DESC