pinehearstEthereum - Beacon Deposit Contract with Event Logs
    Updated 2022-11-05
    with eth2_deposit AS (
    SELECT
    block_timestamp,
    tx_hash,
    origin_from_address,
    32 as eth_deposit,
    event_inputs:amount as amount,
    event_inputs:index as index,
    event_inputs:pubkey as pubkey,
    event_inputs:signature as signature,
    event_inputs:withdrawal_credentials as withdrawal_credentials
    FROM ethereum.core.fact_event_logs
    WHERE 1=1
    AND tx_status = 'SUCCESS'
    AND contract_address = '0x00000000219ab540356cbb839cbe05303d7705fa' -- Beacon Deposit Contract
    -- AND origin_to_address = '0x00000000219ab540356cbb839cbe05303d7705fa' -- Beacon Deposit Contract / there are lido specific
    AND event_name = 'DepositEvent' -- DepositEvent
    -- AND origin_function_signature = '0x22895118' -- Beacon Deposit Contract
    -- AND tx_hash = '0x6b78904db0914d824f6e07f111a4cfd0678f2d16c887cd0be29737596f520eae'
    -- Function: deposit(bytes pubkey, bytes withdrawal_credentials, bytes signature, bytes32 deposit_data_root)
    )
    SELECT
    date(block_timestamp) as date,
    count(tx_hash) as tx_count,
    count(distinct tx_hash) as distinct_tx_count,
    sum(eth_deposit) as eth,
    sum(eth) over (order by date) as total_eth
    FROM eth2_deposit
    WHERE 1=1
    AND amount IS NOT NULL
    AND pubkey IS NOT NULL
    AND signature IS NOT NULL
    AND withdrawal_credentials IS NOT NULL
    GROUP BY 1
    ORDER BY 1 DESC

    Run a query to Download Data