Query editor
with base_info as (select plain_issuer, issuer, etf_ticker, percentage_feefrom (values('Grayscale', get_href('https://etfs.grayscale.com/ethe', 'Grayscale'), 'ETHE', 0.025),('Grayscale Mini Trust', get_href('https://etfs.grayscale.com/eth','Grayscale Mini Trust'), 'ETH', 0.0015 ),('BlackRock', get_href('https://www.blackrock.com/us/financial-professionals/products/337614/ishares-ethereum-trust-etf', 'BlackRock'), 'ETHA', 0.0025),('Fidelity', get_href('https://digital.fidelity.com/prgw/digital/research/quote/dashboard/summary?symbol=FETH', 'Fidelity'), 'FETH', 0.0025),('21Shares', get_href('https://www.21shares.com/en-us/product/ceth', '21Shares'), 'CETH', 0.0021),('Bitwise', get_href('https://ethwetf.com/', 'Bitwise'), 'ETHW', 0.002),('Invesco', get_href('https://www.invesco.com/us/financial-products/etfs/product-detail?audienceType=Advisor&ticker=QETH', 'Invesco'), 'QETH', 0.0025),('VanEck', get_href('https://www.vaneck.com/us/en/investments/ethereum-etf-ethv/overview/', 'VanEck'), 'ETHV', 0.002),('Franklin Templeton', get_href('https://www.franklintempleton.com/investments/options/exchange-traded-funds/products/40521/SINGLCLASS/franklin-ethereum-etf/EZET', 'Franklin Templeton'), 'EZET', 0.0019)) as t(plain_issuer, issuer, etf_ticker, percentage_fee)),non_outflow_addresses as (select 0x8ebda19ddee719dab78def3e22c3d37970e35217 as address, 'Coinbase Staking Contract' as descriptionunion allselect 0x00000000219ab540356cbb839cbe05303d7705fa as address, 'Beacon Deposit Contract' as description),eth_etf_tvl as (select f.issuer, f.etf_ticker, sum(f.amount) as tvlfrom (-- inflowselect a.issuer, a.etf_ticker,case when a.inverse_values = True then -t.amount else t.amount end as amountfrom tokens_ethereum.transfers tinner join dune.balancercap.result_ethereum_etf_addresses 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.etf_ticker,-1 * (case when a.inverse_values = True then -t.amount else t.amount end) as amountfrom tokens_ethereum.transfers tinner join dune.balancercap.result_ethereum_etf_addresses 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 -- (excluded tx to staking contract)) fgroup by 1, 2),totals as (select bi.plain_issuer, bi.issuer, coalesce(cast(t.tvl as double), 0) as tvl, coalesce(cast(t.tvl as double), 0) * pu.price as usd_value,bi.etf_ticker, bi.percentage_feefrom base_info bileft join eth_etf_tvl t on t.etf_ticker = bi.etf_tickerleft join (select price from prices.usd_latest where blockchain is null and symbol = 'ETH' limit 1) pu on true),total_summary as (select sum(tvl) as total_tvlfrom totals)select plain_issuer, issuer, tvl, usd_value,case when ts.total_tvl > 0 then tvl / ts.total_tvl else 0 end as percentage_of_total,