cloudr3nUni ETH USDC 0.05% LVR - eth prices (check lb price)
    Updated 2023-06-04
    with
    uni_swap as (
    select
    block_timestamp,
    tx_hash,
    0.0001 * 500 * 0.01 as fee, -- 0.05%
    to_double(event_inputs:amount1 * pow(10, -6)) as bamount0,
    to_double(event_inputs:amount0 * pow(10, -18)) as bamount1,
    case when bamount1>0 then abs(bamount0) -- usdcOut exclude fees
    else bamount0*(1-fee) end as amount_usd, -- usdcIn minus fees
    case when bamount0>0 then abs(bamount1) -- ethOut exclude fees
    else bamount1*(1-fee) end as eth_swapped,
    case when bamount0>0 then bamount0*fee
    else abs(bamount0)/(1-fee)*fee end as fees_collected_usd, -- tokenIn amount includes fees
    abs(div0(amount_usd, eth_swapped)) as swapPrice,
    case
    when bamount0 > 0 then -1
    when bamount0 < 0 then 1
    end as direction
    from
    arbitrum.core.fact_event_logs
    where
    contract_address = '0xc31e54c7a869b9fcbecc14363cf510d1c41fa443'
    and date(block_timestamp)>='2023-01-01'
    and event_name = 'Swap'
    and event_inputs:amount0 <> 0
    and event_inputs:amount1 <> 0
    and swapPrice<10000
    order by
    block_timestamp desc
    ),

    lb_swap as (
    select
    block_timestamp,
    tx_hash,
    Run a query to Download Data