datavortexzany-turquoise
    Updated 2024-10-27
    WITH protocol_tvl AS (
    SELECT
    protocol,
    SUM(chain_tvl) AS total_chain_tvl
    FROM
    external.defillama.fact_protocol_tvl
    WHERE
    chain ILIKE 'solana'
    GROUP BY
    protocol
    )

    SELECT
    protocol,
    total_chain_tvl AS chain_tvl,
    RANK() OVER (ORDER BY total_chain_tvl DESC) AS TvlRank
    FROM
    protocol_tvl
    ORDER BY
    TvlRank;