Query editor
WITHparams AS (SELECT CURRENT_DATE - INTERVAL '1' DAY AS d1),underlying_map AS (SELECT contract_address, max_by(output_0, call_block_time) AS underlyingFROM compound_v2_ethereum.cerc20_call_underlyingWHERE call_successGROUP BY 1),flows AS (SELECT 'v3_cUSDC_base_withdraw' AS family, evt_block_time AS block_time, evt_tx_hash AS tx_hash, contract_address AS market, 'USDC' AS asset_symbol, amount / 1e6 AS amount_norm, src AS actor, "to" AS to_addrFROM compound_v3_ethereum.cusdcv3_evt_withdraw, params WHERE evt_block_date >= d1UNION ALL SELECT 'v3_cUSDT_base_withdraw', evt_block_time, evt_tx_hash, contract_address, 'USDT', amount / 1e6, src, "to" FROM compound_v3_ethereum.cusdtv3_evt_withdraw, params WHERE evt_block_date >= d1UNION ALL SELECT 'v3_cUSDS_base_withdraw', evt_block_time, evt_tx_hash, contract_address, 'USDS', amount / 1e18, src, "to" FROM compound_v3_ethereum.cusdsv3_evt_withdraw, params WHERE evt_block_date >= d1UNION ALL SELECT 'v3_cWETH_base_withdraw', evt_block_time, evt_tx_hash, contract_address, 'WETH', amount / 1e18, src, "to" FROM compound_v3_ethereum.cwethv3_evt_withdraw, params WHERE evt_block_date >= d1UNION ALLSELECT 'v3_cUSDC_collateral_withdraw', e.evt_block_time, e.evt_tx_hash, e.contract_address, COALESCE(t.symbol,'UNKNOWN'), e.amount / pow(10, COALESCE(t.decimals,18)), e.src, e."to" FROM compound_v3_ethereum.cusdcv3_evt_withdrawcollateral e LEFT JOIN tokens.erc20 t ON t.blockchain='ethereum' AND t.contract_address=e.asset CROSS JOIN params WHERE e.evt_block_date >= d1UNION ALL SELECT 'v3_cUSDT_collateral_withdraw', e.evt_block_time, e.evt_tx_hash, e.contract_address, COALESCE(t.symbol,'UNKNOWN'), e.amount / pow(10, COALESCE(t.decimals,18)), e.src, e."to" FROM compound_v3_ethereum.cusdtv3_evt_withdrawcollateral e LEFT JOIN tokens.erc20 t ON t.blockchain='ethereum' AND t.contract_address=e.asset CROSS JOIN params WHERE e.evt_block_date >= d1UNION ALL SELECT 'v3_cUSDS_collateral_withdraw', e.evt_block_time, e.evt_tx_hash, e.contract_address, COALESCE(t.symbol,'UNKNOWN'), e.amount / pow(10, COALESCE(t.decimals,18)), e.src, e."to" FROM compound_v3_ethereum.cusdsv3_evt_withdrawcollateral e LEFT JOIN tokens.erc20 t ON t.blockchain='ethereum' AND t.contract_address=e.asset CROSS JOIN params WHERE e.evt_block_date >= d1UNION ALL SELECT 'v3_cWETH_collateral_withdraw', e.evt_block_time, e.evt_tx_hash, e.contract_address, COALESCE(t.symbol,'UNKNOWN'), e.amount / pow(10, COALESCE(t.decimals,18)), e.src, e."to" FROM compound_v3_ethereum.cwethv3_evt_withdrawcollateral e LEFT JOIN tokens.erc20 t ON t.blockchain='ethereum' AND t.contract_address=e.asset CROSS JOIN params WHERE e.evt_block_date >= d1UNION ALLSELECT 'v2_cETH_redeem', evt_block_time, evt_tx_hash, contract_address, 'ETH', redeemAmount / 1e18, redeemer, redeemer FROM compound_v2_ethereum.cether_evt_redeem, params WHERE evt_block_date >= d1UNION ALLSELECT 'v2_cERC20_redeem', r.evt_block_time, r.evt_tx_hash, r.contract_address, COALESCE(t.symbol,'UNKNOWN'), r.redeemAmount / pow(10, COALESCE(t.decimals,18)), r.redeemer, r.redeemerFROM compound_v2_ethereum.cerc20_evt_redeem rLEFT JOIN underlying_map u ON u.contract_address=r.contract_addressLEFT JOIN tokens.erc20 t ON t.blockchain='ethereum' AND t.contract_address=u.underlyingCROSS JOIN params WHERE r.evt_block_date >= d1)SELECT *FROM flowsORDER BY amount_norm DESCLIMIT 50