Updated 2023-03-07
    with t1 as

    (select
    TX_HASH as ss,
    date_trunc(day,BLOCK_TIMESTAMP) as date,
    -------------------------- USer
    ORIGIN_FROM_ADDRESS as user ,
    CONTRACT_ADDRESS as vv,
    --amount0In

    ORIGIN_TO_ADDRESS as platform,
    --------------- token in
    case
    when EVENT_INPUTS['fromToken'] is not null then EVENT_INPUTS['fromToken']
    when EVENT_INPUTS['inputToken'] is not null then EVENT_INPUTS['inputToken']
    when EVENT_INPUTS['tokenA'] is not null then EVENT_INPUTS['tokenA']
    end
    as token_in ,

    --------------- amount in
    case when EVENT_INPUTS['amount0'] is not null then (EVENT_INPUTS['amount0'])
    when EVENT_INPUTS['inputAmount'] is not null then (EVENT_INPUTS['inputAmount'])
    when EVENT_INPUTS['inputValue'] is not null then (EVENT_INPUTS['inputValue'])
    when EVENT_INPUTS['amountIn'] is not null then (EVENT_INPUTS['amountIn'])
    when EVENT_INPUTS['amount'] is not null then (EVENT_INPUTS['amount']) --
    when EVENT_INPUTS['amount0In'] is not null and EVENT_INPUTS['amount0In']!='0' then (EVENT_INPUTS['amount0In'] )
    when EVENT_INPUTS['amount0In'] is not null and EVENT_INPUTS['amount0In']='0' then (EVENT_INPUTS['amount1In'] )
    end
    as amount_inn,

    --------------- token out
    case when EVENT_INPUTS['toToken'] is not null then EVENT_INPUTS['toToken']
    Run a query to Download Data