Query editor
with non_outflow_addresses as (select 0x8ebda19ddee719dab78def3e22c3d37970e35217 as address, 'Coinbase Staking Contract' as descriptionunion allselect 0x00000000219ab540356cbb839cbe05303d7705fa as address, 'Beacon Deposit Contract' as descriptionunion allselect 0xeFE9a82d56cd965D7B332c7aC1feB15c53Cd4340 as address, 'Coinbase Batch Deposit 1' as descriptionunion allselect 0xF2Be95116845252A28bD43661651917Dc183dAB1 as address, 'Figment ETH Depositor 1' as descriptionunion allselect 0xF0075B3Cf8953d3E23b0eF65960913Fd97eb5227 as address, 'Figment ETH Depositor 2' as descriptionunion allselect 0x8c1BEd5b9a0928467c9B1341Da1D7BD5e10b6549 as address, 'Liquid Collective Liquid Staked ETH' as description),supply_and_staked as (select day as time, cir_supply, current_stakedfrom dune.balancercap.result_eth_general_stats--where day >= cast('2017-01-01' as timestamp)),company_targets as (select issuer, ticker, targetfrom query_6213389),-- Базовый список всех компаний из таблицы адресовall_companies as (select distinct issuer, ticker from query_6211904--from dune.balancercap.result_ethereum_dats_addresses),eth_dats_tvl as (select f.issuer, f.ticker, sum(f.amount) as tvlfrom (-- inflowselect a.issuer, a.ticker,case when a.inverse_values = True then -t.amount else t.amount end as amountfrom tokens_ethereum.transfers tinner join query_6211904 a on a.address = t.to and a.track_inflow = Truewhere t.token_standard = 'native' and t.amount > 0 -- and t.block_time >= date('2017-10-16')union all-- outflow (excluded staking contract)select a.issuer, a.ticker,-1 * (case when a.inverse_values = True then -t.amount else t.amount end) as amountfrom tokens_ethereum.transfers tinner join query_6211904 a on a.address = t."from" and a.track_outflow = Trueleft join non_outflow_addresses noa on t.to = noa.addresswhere t.token_standard = 'native' and t.amount > 0 --and t.block_time >= date('2017-10-16')and noa.address is null) fgroup by 1, 2),-- tx volumetransaction_counts as (select a.issuer, a.ticker, count(*) as tx_countfrom tokens_ethereum.transfers tinner join query_6211904 a on (a.address = t.to and a.track_inflow = True) or (a.address = t."from" and a.track_outflow = True)