Sandeshdistribution of stakes
    Updated 2022-09-21
    with total_stake as
    ( with
    stake as
    (
    select sum(raw_amount)/1e18 as deposit from ethereum.core.fact_token_transfers
    where contract_address='0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0'
    and to_address='0x5e3ef299fddf15eaa0432e6e66473ace8c13d908'
    and origin_to_address not in ('0x9ee91f9f426fa633d227f7a9b000e28b9dfd8599',lower('0xf03A7Eb46d01d9EcAA104558C732Cf82f6B6B645'),
    lower('0x91730940dce63a7c0501cedfc31d9c28bcf5f905'),lower('0xcfd4b4bc15c8bf0fd820b0d4558c725727b3ce89'),
    lower('0xad0dcc6635a5c38be6b87007210797ad94adb4b7'))
    ),
    unstake as
    (
    select
    sum(raw_amount)/1e18 as unstake from ethereum.core.fact_token_transfers
    where contract_address='0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0'
    and from_address=lower('0x5e3ef299fddf15eaa0432e6e66473ace8c13d908')
    and origin_to_address not in ('0x9ee91f9f426fa633d227f7a9b000e28b9dfd8599',lower('0xf03A7Eb46d01d9EcAA104558C732Cf82f6B6B645'),
    lower('0x91730940dce63a7c0501cedfc31d9c28bcf5f905'),lower('0xcfd4b4bc15c8bf0fd820b0d4558c725727b3ce89'),
    lower('0xad0dcc6635a5c38be6b87007210797ad94adb4b7'))
    )
    select 'total' as staker, (s.deposit)-(u.unstake) as amt from stake s, unstake u
    ),
    lido as
    (with
    stake as
    (
    select 'lido' as staker, sum(raw_amount)/1e18 as amt, 'stake' as act from ethereum.core.fact_token_transfers
    where origin_to_address=lower('0x9ee91f9f426fa633d227f7a9b000e28b9dfd8599')
    and to_address='0x9ee91f9f426fa633d227f7a9b000e28b9dfd8599'
    and contract_address='0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0'
    and from_address not in ('0x5e3ef299fddf15eaa0432e6e66473ace8c13d908')
    ),
    unstake as
    (
    Run a query to Download Data