Afonso_DiazCEX status
    Updated 2024-06-18
    with t as (
    select
    tx_hash,
    block_timestamp,
    amount_raw::bigint/1e6 as amount_usd,
    from_address,
    to_address
    from near.core.ez_token_transfers
    where contract_address = '17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1'
    and block_timestamp::date >= '2024-01-01'
    )

    select
    'From CEX' as type,
    count(distinct tx_hash) as transactions,
    count(distinct to_address) as users,
    sum(amount_usd) as volume_usd,
    avg(amount_usd) as avg_amount_usd
    from t
    where from_address in (select distinct address from near.core.dim_address_labels)

    union all

    select
    'To CEX' as type,
    count(distinct tx_hash) as transactions,
    count(distinct from_address) as users,
    sum(amount_usd) as volume_usd,
    avg(amount_usd) as avg_amount_usd
    from t
    where to_address in (select distinct address from near.core.dim_address_labels)
    QueryRunArchived: QueryRun has been archived