adriaparcerisasCAP Finance: ETH Pool
    Updated 2023-02-24
    WITH
    total_deposits as (
    select
    count(distinct origin_from_address) as total_stakers,
    sum(event_inputs:value/pow(10,18)) as total_eth_deposited
    from arbitrum.core.fact_event_logs x
    join arbitrum.core.dim_labels y on x.contract_address=y.address
    where
    event_name='Deposit' and contract_address='0xe0ccd451bb57851c1b2172c07d8b4a7c6952a54e'
    and tx_status='SUCCESS' AND BLOCK_TIMESTAMP>CURRENT_DATE- INTERVAL '{{timeframe}}'
    ),
    total_withdrawals as (
    select
    count(distinct origin_from_address) as total_unstakers,
    sum(event_inputs:inputAmount/pow(10,18)) as total_eth_withdrawn
    from arbitrum.core.fact_event_logs x
    join arbitrum.core.dim_labels y on x.contract_address=y.address
    where
    event_name='Withdraw' and contract_address='0xe0ccd451bb57851c1b2172c07d8b4a7c6952a54e'
    and tx_status='SUCCESS' AND BLOCK_TIMESTAMP>CURRENT_DATE- INTERVAL '{{timeframe}}'
    )
    SELECT
    total_stakers,total_unstakers,total_stakers-total_unstakers as net_stakers,
    total_eth_deposited,total_eth_withdrawn,total_eth_deposited-total_eth_withdrawn as net_eth_deposited
    from total_deposits,total_withdrawals
    Run a query to Download Data