Query editor
WITH CM_fees AS(SELECT DISTINCT tx_hashFROM arbitrum.logsWHERE contract_address IN (0xc5cea5b650a663699af28973e83a9a6c22b74d5a, 0xD8826D8FE8f05ef5712bEd2533225F77CE4f4722) -- plus previous proxiesAND (topic0 = 0xcb3c0cd7321c8a2866f295ad683bdf846b2b06eef7e847e615a9cbece271bc98 -- evt_FeesPaidToStakingContractOR topic0 = 0x3de361fabaa6bc878ca7b0dab8154432d4b3f7bacca6dc5e9372e1d34214fd7f) -- evt_FeesPaidToPearTreasury)SELECT *, SUM(amount) OVER (PARTITION BY to ORDER BY "date") AS cum_amt_by_recipient,SUM(amount) OVER (PARTITION BY "date") AS amt_by_day,SUM(amount) OVER (ORDER BY "date") AS cum_amount_by_dayFROM (SELECT date_trunc('day', evt_block_time) AS "date",CASE WHEN to = 0x1db59ac2e15b788c2b1bf0e90718c5fc36993fbf THEN 'Team Wallet'WHEN to = 0x5219481bb989295372d6b3f857b00f10b2b22ab5 THEN 'Pear Treasury' -- will change so check back on the results--ELSE CAST(to AS VARCHAR) -- not sure why other random EOAs are involved but also doesn't matter (yet) so ignore for nowEND AS to,SUM(value/1e6) AS amountFROM erc20_arbitrum.evt_TransferWHERE contract_address IN (0xff970a61a04b1ca14834a43f5de4533ebddb5cc8, 0xaf88d065e77c8cc2239327c5edb3a432268e5831) -- USDC.e, USDCAND evt_tx_hash IN (SELECT tx_hash FROM CM_fees)GROUP BY 1, 2)WHERE to IS NOT NULLORDER BY 1 DESC