0-MIDtotal stable coin inflow
    Updated 2023-06-02
    with task1 as (
    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('0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9'), --USDT
    lower('0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8'), --USDC
    lower('0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1'))) --DAI
    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
    Run a query to Download Data