adriaparcerisasCAP Finance: CAP 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
    origin_function_signature='0xb6b55f25' and origin_to_address=lower('0xC8CDd2Ea6A5149ced1F2d225D16a775ee081C67D')
    and tx_status='SUCCESS' and event_name='Transfer' and block_timestamp > CURRENT_DATE- INTERVAL '{{timeframe}}'
    ),
    total_withdrawals as (
    select
    count(distinct origin_from_address) as total_unstakers,
    sum(event_inputs:value/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
    origin_function_signature='0x2e1a7d4d' and origin_to_address=lower('0xC8CDd2Ea6A5149ced1F2d225D16a775ee081C67D')
    and event_inputs:from='0xc8cdd2ea6a5149ced1f2d225d16a775ee081c67d'
    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