Trader JoeSTIPb Users ETH/USDC
    Updated 2024-07-03
    with

    tj_lb_created as (
    select
    decoded_log:LBPair as LBPair,
    decoded_log:binStep as binStep,
    decoded_log:tokenX as tokenX,
    case when t1.decimals is null then 18 else t1.decimals end as tokenXdecimals,
    decoded_log:tokenY as tokenY,
    t2.decimals as tokenYdecimals,
    concat(t1.symbol,' - ',t2.symbol) as lb_name
    from
    arbitrum.core.ez_decoded_event_logs
    left join
    arbitrum.price.ez_asset_metadata t1 on tokenX=t1.token_address
    left join
    arbitrum.price.ez_asset_metadata t2 on tokenY=t2.token_address
    where
    contract_address='0xb43120c4745967fa9b93e79c149e66b0f2d6fe0c'
    and event_name='LBPairCreated'
    and lbpair in (
    -- traderjoe
    '0xb7236b927e03542ac3be0a054f2bea8868af9508'
    )
    ),

    px_tb1 as (
    -- weekly_average
    select
    hour as date_hour,
    price as avg_price,
    token_address,
    decimals
    from
    arbitrum.price.ez_prices_hourly
    where
    QueryRunArchived: QueryRun has been archived