cybergenlab[NFT Overview] NFT Collections TVL
    Updated 2024-11-16
    -- forked from [Bridge Overview] DEX TVL copy @ https://flipsidecrypto.xyz/studio/queries/fc533792-ee56-4a77-9266-590e3e414126

    -- forked from [DEX Overview] DEX TVL @ https://flipsidecrypto.xyz/studio/queries/9af1d06c-322a-42a0-ade1-a45483db7a69

    -- forked from [DeFi Overview] DeFi TVL @ https://flipsidecrypto.xyz/studio/queries/80221384-0268-42dc-ab0f-dd612a9b857d

    -- forked from [DeFi Overview] TVL DeFi Pie Chart @ https://flipsidecrypto.xyz/studio/queries/ee4a128f-f5e2-4ca6-b4cb-6925b7792b86

    -- Get DeFi TVL per sector as per Flipside sectoral definition

    with bridge as (
    select
    date_trunc('month', date) as date,
    'Bridge' as sector,
    protocol,
    category,
    avg(chain_tvl) as tvl
    from external.defillama.fact_protocol_tvl
    where chain = 'Ethereum'
    and category in ('NftFi', 'NFT Lending', 'NFT Marketplace')
    and date >= dateadd(year, -1, date_trunc('month',current_date()))
    and date < date_trunc('month',current_date())
    and chain_tvl >0
    group by 1, 2, 3, 4
    order by 1 desc
    )


    , bridge_tvl as (
    select
    date,
    sector,
    category,
    protocol,
    rank() over (partition by date order by sum(tvl) desc) as tvl_rank,
    sum(tvl) as tvl
    QueryRunArchived: QueryRun has been archived