Sajjadiiieuler_protocol_current_status copy
    Updated 2025-02-07
    -- forked from maybeyonas / euler_protocol_current_status @ https://flipsidecrypto.xyz/maybeyonas/q/s5rQfC4KcpMp/euler_protocol_current_status

    -- forked from euler_vault_current_status @ https://flipsidecrypto.xyz/studio/queries/b0b1ae62-f0b7-4e89-b384-f55af74d45ed

    with
    euler_vault_status as (
    select *
    from $query('16ec9395-8381-40ff-af15-3a450050a486')
    ),
    latest as (
    select
    contract_address,
    asset,
    symbol,
    price_token,
    max_by(total_supplied, block_timestamp) as total_supplied,
    max_by(total_borrowed, block_timestamp) as total_borrowed,
    max_by(utilization_rate, block_timestamp) as utilization_rate,
    max_by(accumulated_fees, block_timestamp) as accumulated_fees,
    max_by(cash, block_timestamp) as cash,
    max_by(interest_accumulators, block_timestamp) as interest_accumulators,
    max_by(borrow_spy, block_timestamp) as borrow_spy,
    max_by(borrow_apy, block_timestamp) as borrow_apy,
    max_by(supply_apy, block_timestamp) as supply_apy,
    max_by(supply_cap, block_timestamp) as supply_cap,
    max_by(borrow_cap, block_timestamp) as borrow_cap,
    max_by(supply_cap_fill, block_timestamp) as supply_cap_fill,
    max_by(borrow_cap_fill, block_timestamp) as borrow_cap_fill,
    max_by(new_discount, block_timestamp) as new_discount,
    max_by(timestamp, block_timestamp) as timestamp,
    from euler_vault_status
    group by 1,2,3,4
    ),
    eth_onchain_prices as (
    select
    token_address,
    QueryRunArchived: QueryRun has been archived