0-MIDDaily & Total Volume by new users base-sc
    Updated 2024-05-29

    with tab1 as (
    select
    TX_HASH
    from base.core.ez_decoded_event_logs
    where EVENT_NAME='LiFiTransferStarted'
    and DECODED_LOG:bridgeData:integrator='jumper.exchange'
    and ORIGIN_TO_ADDRESS='0x1231deb6f5749ef6ce6943a275a1d3e7486f4eae'
    and BLOCK_TIMESTAMP::date>=current_date-30
    and DECODED_LOG:bridgeData:destinationChainId=534352
    ),
    tab2 as (
    select date_trunc('minute',BLOCK_TIMESTAMP) as time
    ,ORIGIN_FROM_ADDRESS
    ,AMOUNT_USD
    from base.core.ez_token_transfers
    where ORIGIN_TO_ADDRESS='0x1231deb6f5749ef6ce6943a275a1d3e7486f4eae'
    and ORIGIN_FROM_ADDRESS=FROM_ADDRESS
    and TX_HASH in (select TX_HASH from tab1)
    and BLOCK_TIMESTAMP::date>=current_date-30
    ),
    tab3 as (
    select date_trunc('day',time) as day
    ,ORIGIN_FROM_ADDRESS
    ,AMOUNT_USD
    ,row_number()over(partition by ORIGIN_FROM_ADDRESS order by day) as time_row
    from tab2
    )
    select day
    ,sum(AMOUNT_USD) as volume
    ,sum(volume)over(order by day) as total_volume
    from tab3
    where time_row=1
    group by 1

    QueryRunArchived: QueryRun has been archived