mucryptoTVL by blockchain/category
    Updated 2024-10-01
    with resps as
    (select defillama.get('/protocols', {}) as resp),

    b as (
    select
    value:category as category,
    value:chainTvls as blockchains
    from resps,
    lateral flatten (input => resp:data)
    where category = 'Governance Incentives'),

    a as (
    select
    *
    from b,
    lateral flatten (input => blockchains)),

    list as (
    select
    key as "BLOCKCHAIN/CATEGORY",
    sum(value) as tvl_,
    from a
    group by 1),

    total as (
    select
    sum(tvl_) as total_number
    from list)

    select
    "BLOCKCHAIN/CATEGORY",
    tvl_,
    case
    when
    tvl_ <1000 then concat('$', to_varchar(cast(tvl_ as decimal(38, 2))::string))
    when
    QueryRunArchived: QueryRun has been archived