Updated 2025-02-19
    -- forked from ATH-TVL-7D @ https://flipsidecrypto.xyz/studio/queries/bed19c99-d18d-4b0a-b6c2-d1591e6fae0c

    with tmp as
    (select
    t1.date as date,
    max(t1.date) over() as last_updated_date,
    t1.chain_id,
    t1.chain,
    t1.tvl_usd,
    t2.max_tvl,
    t2.date as date_on_max_tvl,
    datediff('day', t2.date, current_date()) as last_in_week
    from
    (select
    date,
    chain_id,
    chain,
    tvl_usd
    -- max(tvl_usd) over(partition by chain_id, chain) as max_tvl_usd
    from external.defillama.fact_chain_tvl
    where tvl_usd >= 1000000
    and date >= current_date() - interval '360 days') t1
    left join
    (
    select
    t2.date,
    t1.chain_id,
    t1.chain,
    t1.tvl_usd as max_tvl
    from
    (select
    chain_id,
    chain,
    max(tvl_usd) as tvl_usd
    from external.defillama.fact_chain_tvl
    group by 1,2) t1
    Last run: 25 days agoAuto-refreshes every 12 hours
    CHAIN
    LAST_UPDATED_DATE
    DATE
    TVL_USD
    MAX_TVL
    DATE_ON_MAX_TVL
    1
    Sonic2025-02-18 00:00:00.0002025-02-18 00:00:00.0006033869066033869062025-02-18 00:00:00.000
    2
    Ink2025-02-18 00:00:00.0002025-02-18 00:00:00.000568530059906762025-02-13 00:00:00.000
    3
    Berachain2025-02-18 00:00:00.0002025-02-18 00:00:00.000505897595950589759592025-02-18 00:00:00.000
    4
    Op_Bnb2025-02-18 00:00:00.0002025-02-18 00:00:00.00032064166328110292025-02-13 00:00:00.000
    5
    Elys2025-02-18 00:00:00.0002025-02-18 00:00:00.000190640219064022025-02-18 00:00:00.000
    6
    LaChain Network2025-02-18 00:00:00.0002025-02-18 00:00:00.00012384381123843812025-02-18 00:00:00.000
    7
    Eclipse2025-02-18 00:00:00.0002025-02-18 00:00:00.00044793478453394822025-02-17 00:00:00.000
    8
    Soneium2025-02-18 00:00:00.0002025-02-18 00:00:00.00034065397350985582025-02-17 00:00:00.000
    9
    Unichain2025-02-18 00:00:00.0002025-02-18 00:00:00.000864388386438832025-02-18 00:00:00.000
    10
    Mantra2025-02-18 00:00:00.0002025-02-18 00:00:00.000436841444216942025-02-16 00:00:00.000
    11
    Story2025-02-18 00:00:00.0002025-02-18 00:00:00.00014146073141460732025-02-18 00:00:00.000
    12
    Abstract2025-02-18 00:00:00.0002025-02-18 00:00:00.00012646893129455482025-02-17 00:00:00.000
    13
    UNIT02025-02-18 00:00:00.0002025-02-18 00:00:00.000112502911570992025-02-13 00:00:00.000
    13
    1KB
    255s