Query editor
withtxs as (selectel.tx_hash,max(el.block_date) as block_date -- their is always just one datefromdune.manboy.result_ethereum_zodiac_modules as m -- modulesinner join ethereum.logs as el on el.topic0 = 0x6895c13664aa4f67288b25d7a21d7aaa34916e355fb9b6fae0a139a9085becb8 -- event ExecutionFromModuleSuccessand substring(el.topic1FROM13 FOR 20) = m.module_addressgroup by1)selecttxs.tx_hash,txs.block_date,eeet.contract_address as token_address,sum(cast(eeet.value as double)) as amount_raw,(selectAPPROX_PERCENTILE(price, 0.5) as pricefromprices.usdwherecontract_address = eeet.contract_addressand CAST(minute AS date) = txs.block_date) as token_price_in_usd,sum(eeet.value) / cast(pow(10,(selectmax(decimals) -- all should be the samefromprices.usdwherecontract_address = eeet.contract_addressand CAST(minute AS date) = txs.block_date)) as double) * (selectAPPROX_PERCENTILE(price, 0.5) as pricefromprices.usdwherecontract_address = eeet.contract_addressand CAST(minute AS date) = txs.block_date) as usd_valuefromtxsinner join erc20_ethereum.evt_Transfer as eeet on eeet.evt_tx_hash = txs.tx_hashgroup by1,2,3having