Query editor
with deposits_raw as (selectblock_time,hash,"from" as address,concat('0x', "right"(substring(cast(data as varchar), 11, 64), 40)) as strategy,concat('0x', "right"(substring(cast(data as varchar), 11+64, 64), 40)) as token,bytearray_to_uint256(concat('0x', substring(cast(data as varchar), 11+(64*2), 64))) as amt,datafrom ethereum.transactionswhere to = 0x858646372CC42E1A627fcE94aa7A7033e7CF075Aand substr(data, 1, 4) = 0xe7a050aaand block_time > date('2023-06-12')and success = True),withdraws_raw as (selecttx.block_time,tx.hash,tx."from" as address,tr.value as amtfrom ethereum.transactions txleft join erc20_ethereum.evt_Transfer tr on tx.hash = tr.evt_tx_hashwhere tx.to = 0x858646372CC42E1A627fcE94aa7A7033e7CF075Aand substr(tx.data, 1, 4) in (0xa782d945, 0xf3be65d3)and tx.block_time > date('2023-06-12')and tr.evt_block_time > date('2023-06-12')and tx.success = True),deposits as (select date_trunc('minute', block_time) as minute,sum((amt/power(10, tk.decimals))*tk.price) as total_deposits,sum(amt/power(10, tk.decimals)) as total_deposits_ethfrom deposits_rawjoin prices.usd tk on cast(tk.contract_address as varchar) = token and tk.minute = date_trunc('minute', block_time)where tk.minute > date('2023-06-12')and tk.blockchain = 'ethereum'group by 1),withdraws as(select date_trunc('minute', block_time) as minute,sum(amt/1e18) as total_withdraws_ethfrom withdraws_rawgroup by 1)SELECTd.minute,SUM(total_deposits_eth) OVER (ORDER BY d.minute asc rows between unbounded preceding and current row) AS "deposits"FROMdeposits dORDER BYminute ASC;