Sajjadiiimeta pool 1
    Updated 2024-12-22
    with price_tab AS (
    SELECT
    hour::date AS price_date
    , CASE when token_address = 'wrap.near' then 'stNEAR'
    when token_address = 'aaaaaa20d9e0e2461697782ef11675f668207961.factory.bridge.near' then 'stAur'
    when token_address = 'meta-pool.near' then 'wNEAR'
    end AS symbol
    , avg(price) AS price
    FROM near.price.ez_prices_hourly
    WHERE token_address IN (
    'wrap.near'
    ,'aaaaaa20d9e0e2461697782ef11675f668207961.factory.bridge.near'
    --,'meta-pool.near'
    )
    GROUP BY 1 , 2

    UNION all

    SELECT hour::date AS price_date , 'mpETH' AS symbol , avg(price) AS price
    FROM ethereum.price.ez_prices_hourly
    WHERE token_address = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'

    GROUP BY 1 , 2

    ),


    stNear_liquidity AS (
    SELECT
    block_timestamp
    ,tx_hash
    ,signer_id AS user_address
    ,'stNEAR'AS lps
    ,iff(try_parse_json(clean_log):event = 'ADD.L' ,'Add liquidity' , 'Remove liquidity') AS type
    ,iff(try_parse_json(clean_log):event = 'ADD.L'
    ,try_parse_json(clean_log):amount/pow(10,24)
    QueryRunArchived: QueryRun has been archived