mamad-5XN3k32024-04-09 05:29 PM
    Updated 2024-04-09
    /*with namet as (
    select
    OWNER_ADDRESS,
    DOMAIN
    from aptos.core.dim_aptos_names
    where IS_ACTIVE = 'TRUE'
    and IS_PRIMARY = 'TRUE'
    )*/

    SELECT
    dates,
    user,
    sum(volume) as balance,
    rank() over(partition by dates order by balance desc) as rank
    from(
    select
    date_trunc('day', BLOCK_TIMESTAMP) as dates,
    TO_ADDRESS as user,
    sum(amount) as volume
    from aptos.core.ez_native_transfers
    where token_address = '0x1::aptos_coin::AptosCoin'
    group by 1,2

    union

    select
    date_trunc('day', BLOCK_TIMESTAMP) as dates,
    FROM_ADDRESS as user,
    -1*sum(amount) as volume
    from aptos.core.ez_native_transfers
    where token_address = '0x1::aptos_coin::AptosCoin'
    group by 1,2
    )
    group by 1,2

    QueryRunArchived: QueryRun has been archived