Query editor
SELECTdate_trunc('week', block_time) as week, COALESCE(c.name, 'from') as integration_type, SUM(CAST(t.value as double) / 1e18) as ETH_in -- ETH value or, approx_distinct(tx_hash) as times_called -- # times calledFROM ethereum.traces tLEFT JOIN labels.contracts c ON c.blockchain = 'ethereum' AND c.address = t."from"LEFT JOIN ethereum.signatures sig ON sig.id = bytearray_substring(t.input, 1, 5)WHERE t."to" = {{W2_contract}} -- default is Lido: steth tokenAND cardinality(trace_address) != 0 -- if it is 0, it means high level tx. which means a EOA directly called it. we only want contractsAND block_time > now() - interval '{{W2_months ago}}' monthAND successAND lower(c.name) NOT LIKE '%gnosis%' AND lower(c.name) NOT LIKE '%argent%' -- multisig is not integration. excludeAND (json_value(abi, 'strict $.stateMutability') NOT IN ('view', 'pure') OR sig.id IS NULL)GROUP BY 1, 2