Sbhn_NP2024-05-20 07:33 PM
    Updated 2025-01-11
    with price as (
    select hour::date as datee,
    token_address,
    avg(price) as usdprice
    from aptos.price.ez_prices_hourly
    group by 1,2
    )

    select date_trunc('day',block_timestamp) as date,
    name,
    count(DISTINCT ACCOUNT_ADDRESS) as users,
    sum(amount/pow(10,decimals)*usdprice) as deposited
    from aptos.core.fact_transfers a
    join aptos.core.fact_transactions using(tx_hash)
    join price p on block_timestamp::date=datee and a.token_address=p.token_address
    left join aptos.core.dim_tokens t on a.token_address=t.token_address
    where payload:function = '0xc6bc659f1649553c1a3fa05d9727433dc03843baac29473c817d06d39e7621ba::scripts::supply'
    and transfer_event = 'WithdrawEvent'
    and block_timestamp::date >= current_date-30
    group by 1,2



    QueryRunArchived: QueryRun has been archived