0-MID daily trove inflow
    Updated 2023-04-13
    with act1 as (
    with tab1 as (
    select BLOCK_TIMESTAMP::date as date
    ,TX_HASH
    from arbitrum.core.fact_event_logs
    where ORIGIN_TO_ADDRESS='0xc873fecbd354f5a56e00e710b90ef4201db2448d' --Camelot Dex
    and TX_STATUS='SUCCESS'
    and EVENT_NAME='Swap'
    and date>='2023-01-01'),
    tab2 as (
    select BLOCK_TIMESTAMP::date as date
    ,TX_HASH
    ,ORIGIN_FROM_ADDRESS
    ,CONTRACT_ADDRESS
    ,RAW_AMOUNT
    from arbitrum.core.fact_token_transfers
    where date>='2023-01-01'
    and ORIGIN_FROM_ADDRESS=FROM_ADDRESS
    and CONTRACT_ADDRESS in
    (lower('0x982239D38Af50B0168dA33346d85Fb12929c4c07'))) --Trove
    select tab2.date
    ,tab2.TX_HASH
    ,ORIGIN_FROM_ADDRESS
    ,CONTRACT_ADDRESS
    ,RAW_AMOUNT
    from tab1
    left join tab2
    on tab1.TX_HASH=tab2.TX_HASH
    and tab1.date=tab2.date),
    act2 as (
    select ADDRESS
    ,DECIMALS
    ,SYMBOL
    from arbitrum.core.dim_contracts)
    select date
    ,sum(RAW_AMOUNT/pow(10,decimals)) as volume
    Run a query to Download Data