mucryptoTop 10 protocols by TVL (USD) 2024-08-22 01:03 AM
    Updated 2024-08-21
    with resps as
    (select defillama.get('/protocols', {}) as resp),

    list as (
    select
    value:category as category,
    value:parentProtocol as protocol,
    value:name as name,
    value:tvl as tvl
    from resps,
    lateral flatten (input => resp:data)
    where category = 'Reserve Currency'),

    m_protocols as (
    select
    substr(protocol, 8) as protocol,
    sum(tvl) as tvl
    from list
    group by 1),

    protocols as (
    select
    name,
    sum(tvl) as tvl
    from list
    where protocol is null
    group by 1),

    final_list as (
    select
    protocol,
    tvl
    from m_protocols
    where protocol is not null

    union all
    QueryRunArchived: QueryRun has been archived