Query editor
WITH stable AS (SELECTcontract_address,decimals,case when symbol='PAX' then 'USDP'when symbol='UST' then 'USTC'else symbol end as symbolFROM tokens.erc20WHERE contract_address IN (select distinct address from query_1879804 where chain = 'ethereum' and address <> 0xa693b19d2931d498c5b318df961919bb4aee87a5)unionselect address, 18 as decimals, stablecoin as symbol from query_1879804 where stablecoin = 'GHO'unionselect address, 6 as decimals, stablecoin as symbol from query_1879804 where stablecoin = 'PYUSD'unionselect address, 18 as decimals, stablecoin as symbol from query_1879804 where stablecoin = 'FDUSD'unionselect address, 18 as decimals, stablecoin as symbol from query_1879804 where stablecoin = 'sDAI'unionselect address, 18 as decimals, stablecoin as symbol from query_1879804 where stablecoin = 'USDM'unionselect address, 18 as decimals, stablecoin as symbol from query_1879804 where stablecoin = 'RR'unionselect address, 18 as decimals, stablecoin as symbol from query_1879804 where stablecoin = 'hyUSD'unionselect address, 18 as decimals, stablecoin as symbol from query_1879804 where stablecoin = 'USDY'unionselect address, 18 as decimals, stablecoin as symbol from query_1879804 where stablecoin = 'CHAI'unionselect address, 18 as decimals, stablecoin as symbol from query_1879804 where stablecoin = 'sFRAX'unionselect address, 18 as decimals, stablecoin as symbol from query_1879804 where stablecoin = 'USDe'unionselect address, 18 as decimals, stablecoin as symbol from query_1879804 where stablecoin = 'EURCV'),daily_change as (select day, contract_address, symbol, sum(amount) as amountfrom (SELECTdate_trunc('day', evt_block_time) AS day,b.contract_address, b.symbol,cast(value as double)/power(10,decimals)*-1 AS amountFROM erc20_ethereum.evt_Transfer aLEFT JOIN stable b ON a.contract_address = b.contract_addressWHERE a.contract_address IN (SELECT contract_address FROM stable where symbol not in ('eUSD','TUSD','crvUSD','sDAI'))AND "to" in (0x0000000000000000000000000000000000000000,0xc6cde7c39eb2f0f0095f41570af89efc2c1ea828)UNION ALLSELECTdate_trunc('day', evt_block_time) AS day,b.contract_address,b.symbol,cast(value as double)/power(10,decimals) AS amountFROM erc20_ethereum.evt_Transfer aLEFT JOIN stable b ON a.contract_address = b.contract_addressWHERE a.contract_address IN (SELECT contract_address FROM stable where symbol not in ('eUSD','TUSD','crvUSD','sDAI'))AND "from" in (0x0000000000000000000000000000000000000000,0xc6cde7c39eb2f0f0095f41570af89efc2c1ea828)UNION ALLSELECTdate_trunc('day', evt_block_time) AS day,0x97de57ec338ab5d51557da3434828c5dbfada371 as contract_address,'eUSD' as symbol,-cast(amount as double)/1e18 AS amountFROM lybra_finance_ethereum.Lybra_depositor_evt_Burn