Query editor
WITH etokens_address AS (SELECT DISTINCT proxyFROM euler_ethereum.Euler_evt_ProxyCreatedWHERE CAST(moduleid AS DECIMAL) = 500000),dtokens_address AS (SELECT DISTINCT proxyFROM euler_ethereum.Euler_evt_ProxyCreatedWHERE CAST(moduleid AS DECIMAL) = 500001),etokens_in AS (SELECT "to", SUM(CAST(value AS DECIMAL)/1e18) AS sum_etokens_inFROM erc20_ethereum.evt_TransferWHERE contract_address IN (SELECT *FROM etokens_address)GROUP BY "to"),etokens_out AS (SELECT "from", SUM(CAST(value AS DECIMAL)/1e18) AS sum_etokens_outFROM erc20_ethereum.evt_TransferWHERE contract_address IN (SELECT *FROM etokens_address)GROUP BY "from"),etokens_total AS (SELECT"to","from",sum_etokens_in,sum_etokens_out,(sum_etokens_in - sum_etokens_out) AS total_etokensFROM etokens_inJOIN etokens_outON etokens_in."to" = etokens_out."from"),dtokens_in AS (SELECT "to", SUM(CAST(value AS DECIMAL)/1e18) AS sum_dtokens_inFROM erc20_ethereum.evt_TransferWHERE contract_address IN (SELECT *FROM dtokens_address)GROUP BY "to"),dtokens_out AS (SELECT "from", SUM(CAST(value AS DECIMAL)/1e18) AS sum_dtokens_outFROM erc20_ethereum.evt_TransferWHERE contract_address IN (SELECT *FROM dtokens_address)GROUP BY "from"),dtokens_total AS (SELECT"to",