amir007Merge Staking Providers - Distribution ETH
    Updated 2022-09-03
    -- https://etherscan.io/token/0xae78736cd615f374d3085123a210448e74fc6393 -- Rocket Pool ETH contract address
    with rokcetpool_txs as
    (
    select block_timestamp::date as date
    , tx_hash
    , event_inputs:to as staker
    , (event_inputs:value / 1e18) as amount_staked_eth
    from ethereum_core.fact_event_logs
    where contract_address = '0xae78736cd615f374d3085123a210448e74fc6393'
    and block_timestamp >= current_date - {{PastDays}}
    and event_inputs:from = '0x0000000000000000000000000000000000000000'
    and event_name = 'Transfer'
    ), eth_price as
    (
    select hour::date as date
    , avg(price) as price
    from ethereum.core.fact_hourly_token_prices
    where symbol = 'WETH'
    and hour::date >= current_date - {{PastDays}}
    group by 1
    ), staked_eth as
    (
    select sum(amount_staked_eth) as sum_amount_staked_eth
    , sum(amount_staked_eth * eth_price.price) as sum_amount_staked_eth_usd
    from rokcetpool_txs
    join eth_price on rokcetpool_txs.date = eth_price.date
    ), depositor as
    (
    select count(distinct staker) as count_depositor
    from rokcetpool_txs
    ), eth_deposit as
    (
    select avg(amount_staked_eth) as avg_amount_staked_eth
    , median(amount_staked_eth) as median_amount_staked_eth
    , min(amount_staked_eth) as min_amount_staked_eth
    , max(amount_staked_eth) as max_amount_staked_eth
    Run a query to Download Data