Sbhn_NPfunny-red
    Updated 2024-11-23
    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
    symbol,
    sum(amount/pow(10,decimals)*usdprice) as vol
    from aptos.core.fact_transfers a
    join aptos.core.fact_transactions using(tx_hash,block_timestamp)
    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 tx_hash ='0x7422ad32fc8b97064f6ed2c29ce5058a9c58eeb113c57776cace44a1a80bd104'
    where payload_function in ('0x68476f9d437e3f32fd262ba898b5e3ee0a23a1d586a6cf29a28add35f253f6f7::meso::deposit',
    '0x68476f9d437e3f32fd262ba898b5e3ee0a23a1d586a6cf29a28add35f253f6f7::meso::deposit_coin')
    and transfer_event = 'WithdrawEvent'
    group by 1

    QueryRunArchived: QueryRun has been archived