Flipside Teamnear platforms - total tvl
    Updated 2024-11-27
    -- forked from near platforms - total tvl @ https://flipsidecrypto.xyz/edit/queries/7097314c-f824-4c99-ba14-b179e9ad448c

    with
    prices as (
    select date_trunc(day, TIMESTAMP) as date, TOKEN_CONTRACT, avg(PRICE_USD) as price
    from near.price.fact_prices
    where TOKEN_CONTRACT!='aurora'
    group by 1,2
    union all
    select date_trunc(day, TIMESTAMP) as date, 'phoenix-bonds.near', avg(PRICE_USD) as price
    from near.price.fact_prices
    where TOKEN_CONTRACT='wrap.near'
    group by 1,2
    union all
    select date_trunc(day, TIMESTAMP) as date, 'near', avg(PRICE_USD) as price
    from near.price.fact_prices
    where TOKEN_CONTRACT='wrap.near'
    group by 1,2
    union all
    select date_trunc(day, HOUR) as date, 'token.sweat' TOKEN_ADDRESS, avg(PRICE) as price
    from crosschain.price.ez_prices_hourly
    where symbol='SWEAT' and BLOCKCHAIN='ethereum'
    group by 1,2
    union all
    select date_trunc(day, HOUR) as date, 'aurora' TOKEN_ADDRESS, avg(PRICE) as price
    from crosschain.price.ez_prices_hourly
    where TOKEN_ADDRESS='0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' and BLOCKCHAIN='ethereum'
    group by 1,2
    ),

    tokens as (
    select SYMBOL, CONTRACT_ADDRESS as TOKEN_CONTRACT, DECIMALS
    from near.core.dim_ft_contract_metadata
    QUALIFY row_number() over (partition by TOKEN_CONTRACT order by SYMBOL desc)=1
    union all
    select 'pNEAR', 'phoenix-bonds.near', 24
    Auto-refreshes every 24 hours
    QueryRunArchived: QueryRun has been archived