0-MIDnew poly copy
    Updated 2024-03-01
    -- forked from new poly @ https://flipsidecrypto.xyz/edit/queries/cee96dc7-53a2-49d3-845d-59acf4dd0904


    with tab1 as (
    select
    TX_HASH
    from polygon.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>='2024-01-01'
    ),
    tab2 as (
    select date_trunc('minute',BLOCK_TIMESTAMP) as time
    ,ORIGIN_FROM_ADDRESS
    ,AMOUNT_USD
    from polygon.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>='2024-01-01'
    ),
    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