Query editor
WITHdeposit_summary AS (SELECTCOUNT(*) as total_deposits,SUM(amount_staked) as total_eth_staked,AVG(amount_staked) as avg_deposit_size,MIN(block_time) as first_deposit,MAX(block_time) as last_deposit,COUNT(DISTINCT tx_from) as unique_depositorsFROM staking_ethereum.depositsWHERE withdrawal_address = 0xe3c44d4d25172ef2e0cdb9e09189a8ca4ed878f4),-- withdrawalwithdrawal_summary AS (SELECTCOUNT(*) as total_withdrawals,SUM(amount / 1e9) as total_eth_withdrawn,COUNT(DISTINCT validator_index) as active_validators,MIN(block_time) as first_withdrawal,MAX(block_time) as last_withdrawalFROM ethereum.withdrawalsWHERE address = 0xe3c44d4d25172ef2e0cdb9e09189a8ca4ed878f4),-- transactiontransaction_summary AS (SELECTCOUNT(*) as total_transactions,SUM(CASE WHEN "to" = 0xe3c44d4d25172ef2e0cdb9e09189a8ca4ed878f4 THEN 1 ELSE 0 END) as inflow_count,SUM(CASE WHEN "from" = 0xe3c44d4d25172ef2e0cdb9e09189a8ca4ed878f4 THEN 1 ELSE 0 END) as outflow_count,ROUND(SUM(CASE WHEN "to" = 0xe3c44d4d25172ef2e0cdb9e09189a8ca4ed878f4 THEN value / 1e18 ELSE 0 END), 4) as total_inflows,ROUND(SUM(CASE WHEN "from" = 0xe3c44d4d25172ef2e0cdb9e09189a8ca4ed878f4 THEN value / 1e18 ELSE 0 END), 4) as total_outflows,ROUND(SUM(CASE WHEN "from" = 0xe3c44d4d25172ef2e0cdb9e09189a8ca4ed878f4 THEN (gas_used * gas_price) / 1e18 ELSE 0 END), 4) as total_gas_costFROM ethereum.transactionsWHERE ("to" = 0xe3c44d4d25172ef2e0cdb9e09189a8ca4ed878f4OR "from" = 0xe3c44d4d25172ef2e0cdb9e09189a8ca4ed878f4)AND success = trueAND value > 0)SELECT-- depositd.total_deposits as "Total Deposits",ROUND(d.total_eth_staked, 4) as "Total ETH Staked",ROUND(d.avg_deposit_size, 4) as "Avg Deposit Size",d.first_deposit as "First Deposit Date",d.last_deposit as "Last Deposit Date",-- validatorw.active_validators as "Active Validators",-- withdrawalsw.total_withdrawals as "Total Withdrawals",ROUND(w.total_eth_withdrawn, 4) as "Total ETH Withdrawn",w.first_withdrawal as "First Withdrawal Date",w.last_withdrawal as "Last Withdrawal Date",-- rewards calculationROUND(w.total_eth_withdrawn - d.total_eth_staked, 4) as "Net Rewards Earned (ETH)",