Query editor
WITH days AS (SELECTtimestamp as dayFROM utils.daysWHERE timestamp >= DATE('2023-12-16')GROUP BY 1),all_data as (select*from (selectel.block_time,el.block_date as block_date,date_trunc('week', block_date) as block_week,el.tx_hash,bytearray_substring(data, 13, 20) as token,bytearray_to_uint256(bytearray_substring(data,33,32)) as amount_raw,bytearray_substring(data, 77, 20) as recipientfromethereum.logs elwhere el.contract_address = 0xf2F305D14DCD8aaef887E0428B3c9534795D0d60and el.topic0 = 0xd742cda664e1fb0906a48ed895215860dca3e7168cc6c91163dd3d6fdcaf9cea) xwhere block_week >= date '2023-01-01'),eth_token_inflows as (select block_date as day, token as contract_address, (amount_raw / 1e18) as token_amount from all_data),eth_token_prices AS (SELECTDATE_TRUNC('day', timestamp) as day,contract_address,AVG(price) as avg_price_usdFROM prices.dayWHERE blockchain = 'ethereum'AND symbol = 'ETH'AND contract_address = 0x0000000000000000000000000000000000000000GROUP BY 1, 2),eth_daily_inflows AS (SELECTt.day,SUM(t.token_amount * p.avg_price_usd) as usd_valueFROM eth_token_inflows tLEFT JOIN eth_token_prices pON t.day = p.dayAND t.contract_address = p.contract_addressGROUP BY 1),sol_exchange_rates AS (SELECTday,vault,token_rates as exchange_rate