Query editor
--concept forked from @ahkek (https://dune.com/queries/3069562/5116361)with tokens as (select * from query_1983721),open_eden as (select dt, sum(net) over (order by dt) as market_open_edenfrom (select date_trunc('week',dt) as dt, sum(amount_dep) as netfrom (select date_trunc('day', evt_block_time) as dt, assets/1e6 as amount_depfrom tbill_ethereum.OpenEdenVault_evt_Depositunion allselect date_trunc('day', evt_block_time) as dt, (assets/-1e6) as amount_witfrom tbill_ethereum.OpenEdenVault_evt_Withdraw)group by 1)),ondo_price as (select date_trunc('week', evt_block_time) as dt, avg(newPrice/1e18) as pricefrom (select evt_block_time, fToken as flux_token_address, newPricefrom fluxfinance_ethereum.OndoPriceOracleV2_evt_UnderlyingPriceSetwhere evt_block_time != timestamp'2023-03-27'union allselect block_time as evt_block_time,0x1dd7950c266fb1be96180a8fdb0591f70200e018 as flux_token_address,bytearray_to_uint256(bytearray_substring(data, 33,32)) as newPricefrom ethereum.logswhere contract_address = 0xc53e6824480d976180A65415c19A6931D17265BAand topic0 = 0x1ad78d5a9c05e5f0ee9ff6e3817cc97a99b504483f99ebc08d431bd5c707c741and block_time != timestamp'2023-03-27')where newPrice/1e18 < 1000group by 1),delta as (select cast(evt_block_time as date) as period, 'ethereum' as blockchain, contract_address, cast(value as double) as delta,null as transfer,case when "from" = 0x0000000000000000000000000000000000000000 then cast(value as double) end as minted,null as burnedfrom erc20_ethereum.evt_Transferinner join tokens using (contract_address)where to <> 0x0000000000000000000000000000000000000000and blockchain = 'ethereum'