Penta Limited TeamWeekly Base 6
    Updated 2024-12-09
    WITH unique_nft_mints AS (
    SELECT DISTINCT
    tx_hash,
    BLOCK_NUMBER,
    BLOCK_TIMESTAMP,
    NFT_ADDRESS,
    NFT_TO_ADDRESS,
    PROJECT_NAME,
    TOKENID,
    avg(ERC1155_VALUE) as ERC1155_VALUE
    FROM
    base.nft.ez_nft_transfers
    WHERE nft_from_address='0x0000000000000000000000000000000000000000'
    and BLOCK_TIMESTAMP >= current_date - INTERVAL '12 WEEKS'
    and BLOCK_TIMESTAMP < date_trunc('week',current_date)
    group by 1,2,3,4,5,6,7
    )

    , weekly_nft_stats AS (
    SELECT
    date_trunc('week', BLOCK_TIMESTAMP) AS week,
    COUNT(DISTINCT tx_hash) AS num_nft_transactions,
    COUNT(DISTINCT NFT_TO_ADDRESS) AS num_nft_users,
    LAG(num_nft_transactions) OVER (ORDER BY week) AS num_nft_transactions_last_week,
    LAG(num_nft_users) OVER (ORDER BY week) AS num_nft_users_last_week
    FROM
    unique_nft_mints
    GROUP BY 1
    )

    SELECT
    week,
    num_nft_transactions,
    num_nft_transactions_last_week,
    (num_nft_transactions - num_nft_transactions_last_week)/num_nft_transactions_last_week * 100 AS num_nft_transactions_diff,
    num_nft_users,
    QueryRunArchived: QueryRun has been archived