Sandeshgam3rs Royalties
    Updated 2025-01-13
    /*
    Purpose:
    Retrieve weekly NFT royalties and cumulative royalties over the past 3 months for a specific contract.
    */

    WITH sales_table AS (
    SELECT
    DATE_TRUNC('week', block_timestamp) AS date,
    SUM(creator_fee_usd) AS royalties,
    SUM(royalties) OVER (ORDER BY date ASC) AS cumulative_royalties
    FROM ethereum.nft.ez_nft_sales
    WHERE nft_address = LOWER('0xDE76aD8998310dd4C6cA9fdb03a5F20bbf01Ce96')
    GROUP BY date
    ORDER BY date DESC
    )

    SELECT *
    FROM sales_table
    WHERE date >= CURRENT_TIMESTAMP - INTERVAL '3 months';

    QueryRunArchived: QueryRun has been archived