mucryptoLido's dominance 2023-09-07 11:56 AM
    Updated 2024-03-09
    with resps as
    (select defillama.get('/v2/historicalChainTvl', {}) as resp),

    figure as (
    select
    value:date::timestamp as date,
    value:tvl as tvl
    from resps,
    lateral flatten (input => resp:data)
    order by date desc
    limit 1),

    protocols as
    (select defillama.get('/protocols', {}) as resp),

    lido as (
    select
    value:category::string as category,
    value:name::string as name,
    value:tvl as lido_tvl,
    value:description::string as description
    from protocols,
    lateral flatten (input => resp:data)
    where category = 'Liquid Staking'
    and name in ('Lido'))

    select
    'Lido' as name,
    tvl,
    cast(lido_tvl / tvl * 100 as decimal(38,2)) as tvl_market_share
    from figure
    inner join lido

    union all

    select
    QueryRunArchived: QueryRun has been archived