Query editor
WITH CurrentSDPriceInETH AS (SELECTcall_block_time,output_0 / 1e18 AS sd_price_in_ethFROM stader_ethereum.StaderOracle_call_getSDPriceInETHORDER BY call_block_time DESCLIMIT 1),bondTransactions AS (SELECT"from" AS operator,SUM(value / 1e18) AS total_ethFROM ethereum.transactionsWHERE"to" = 0x4f4Bfa0861F62309934a5551E0B2541Ee82fdcF1AND value > 0GROUP BY "from"),sdTransactionsSum AS (SELECT"from" AS operator,SUM(ROUND(value / 1e18)) AS total_sdFROM erc20_ethereum.evt_TransferWHERE"to" = 0x7af4730cc8ebad1a050dcad5c03c33d2793ee91fGROUP BY "from"),AllOperators AS (SELECTeth.operator,eth.total_eth,COALESCE(sd.total_sd, 0) AS total_sd,eth.total_eth / 4 AS number_of_validators,COALESCE(sd.total_sd, 0) / (eth.total_eth / 4) AS actual_sd_per_validator,COALESCE(sd.total_sd, 0) / (eth.total_eth / 4) * CurrentSDPriceInETH.sd_price_in_eth AS sd_in_ethFROM bondTransactions AS ethLEFT JOIN sdTransactionsSum AS sd ON eth.operator = sd.operatorCROSS JOIN CurrentSDPriceInETH)SELECTCASEWHEN sd_in_eth < 0.4 THEN 'under-col'WHEN sd_in_eth >= 0.4 AND sd_in_eth < 0.6 THEN '10%-15%'WHEN sd_in_eth >= 0.6 AND sd_in_eth < 0.8 THEN '>15%-20%'WHEN sd_in_eth >= 0.8 AND sd_in_eth < 1 THEN '>20%-25%'WHEN sd_in_eth >= 1 AND sd_in_eth < 8 THEN '>25%-200%'ELSE '>200%'END AS sd_in_eth_group,COUNT(DISTINCT operator) * 100.0 / (SELECT COUNT(DISTINCT operator) FROM AllOperators) AS percentage_of_all_operatorsFROM AllOperatorsGROUP BYCASEWHEN sd_in_eth < 0.4 THEN 'under-col'WHEN sd_in_eth >= 0.4 AND sd_in_eth < 0.6 THEN '10%-15%'WHEN sd_in_eth >= 0.6 AND sd_in_eth < 0.8 THEN '>15%-20%'WHEN sd_in_eth >= 0.8 AND sd_in_eth < 1 THEN '>20%-25%'