Query editor
witharb_weekly_rewards as (selectDATE_TRUNC('week', evt_block_time) as Week,sum(rewardValue) / 1e8 as Rewardsfromchi_protocol_ethereum.ArbitrageV4_evt_ExecuteArbitragegroup by1),transfers as (selectevt_block_time,evt_tx_hash,"from","to",case-- Mints to the contract and Transfers to the Safe needs to be includedwhen "from" = 0x0000000000000000000000000000000000000000or "to" = 0xcdB8d92FA641106fdAEe3CCC6B53a029eDb9c458 then value / 1e18-- All other outgoing Transfers needs to be excludedelse - value / 1e18end as valuefromerc20_ethereum.evt_transferwherecontract_address = 0x3b21418081528845a6DF4e970bD2185545b712baand (-- Mints to the Arbitrage contract("from" = 0x0000000000000000000000000000000000000000and "to" = 0x8b75deB16D45fAc788bD9f2ac18E79C369eB84BD)-- All outgoing Transfersor "from" = 0x8b75deB16D45fAc788bD9f2ac18E79C369eB84BD)),weekly_transfers as (selectDATE_TRUNC('week', evt_block_time) as Week,sum(value) as Valuefromtransfersgroup by1)SELECTCOALESCE(a.Week, t.Week) AS Week,a.rewards as rewards,t.value as value,a.rewards + t.value as "Total Rewards"FROMarb_weekly_rewards aFULL JOIN weekly_transfers t ON a.Week = t.Weekorder by1 desc;