Updated 2025-03-28
    with

    main as (
    select
    tx_hash,
    block_timestamp,
    origin_from_address as user,
    a.contract_address as token_address,
    iff(from_address = origin_to_address, 'Deposit', 'Withdraw') as event_name,
    a.symbol,
    a.amount,
    a.amount_usd
    from
    boba.core.ez_token_transfers a
    where
    origin_to_address = '0x54ecc8832b65c2db0c53235cde94991c5cdcabf9'
    and origin_to_address in (from_address, to_address)
    )

    select
    count(distinct tx_hash) as transactions,
    count(distinct user) as users,
    sum(iff(event_name = 'Deposit', amount, -amount)) as netflow_volume,
    sum(iff(event_name = 'Deposit', amount_usd, -amount_usd)) as netflow_volume_usd
    from
    main