Query editor
with total_eth2_amounts as (select time, sum(staked_eth) as total_depositedfrom (select date_trunc('day',block_time) as time, sum(cast(value as double))/1e18 as staked_ethFROM ethereum.tracesWHERE "to" = 0x00000000219ab540356cBB839Cbe05303d7705FaAND (LOWER(call_type) NOT IN ('delegatecall', 'callcode', 'staticcall') or call_type is null)AND successAND cast(value as double) > 0AND block_time>=date('2020-11-03')group by 1/* union allselect date_trunc('day',block_time) as time, sum(cast(value as double))/1e18*-1 as staked_ethFROM ethereum.tracesWHERE "from" = 0x00000000219ab540356cBB839Cbe05303d7705FaAND (LOWER(call_type) NOT IN ('delegatecall', 'callcode', 'staticcall') or call_type is null)AND successAND block_time>=date('2020-11-03')AND cast(value as double) > 0group by 1*/)agroup by 1), lido_eth2_amounts AS (select DATE_TRUNC('day', block_time) AS time, sum(amount_staked) as lido_daily_amountfrom staking_ethereum.depositswhere depositor_entity = 'Lido'group by 1), lido_eth2_amounts_with_lead as (select time,lead(time, 1, date_trunc('day',now() + interval '24' hour)) over (order by time) as next_time,lido_daily_amount,sum(cast(lido_daily_amount AS DOUBLE)) over (order by time) as lido_depositedfrom lido_eth2_amounts)selectcoalesce(t.time, l.time) as time, l.lido_deposited as lido_deposited,sum(t.total_deposited) over (order by coalesce(t.time, l.time)) as total_deposited,(sum(t.total_deposited) over (order by coalesce(t.time, l.time)) - coalesce(l.lido_deposited,0)) as others,100*l.lido_deposited/sum(t.total_deposited) over (order by coalesce(t.time, l.time)) as lido_sharefrom total_eth2_amounts tleft join lido_eth2_amounts_with_lead l on t.time >= l.time and t.time < l.next_time/*with eth2_amounts AS (select('x' || substring(encode(amount::bytea, 'hex') from 15 for 2) ||substring(encode(amount::bytea, 'hex') from 13 for 2) ||substring(encode(amount::bytea, 'hex') from 11 for 2) ||substring(encode(amount::bytea, 'hex') from 9 for 2) ||