bobby_danielyodelling-salmon
    Updated 2025-04-02
    WITH prices AS (
    SELECT hour,
    price as sei_price
    FROM sei.price.ez_prices_hourly
    WHERE symbol = 'SEI'
    AND blockchain = 'sei'
    AND is_native = TRUE
    )

    SELECT
    count(distinct e.origin_from_address) as unique_minters,
    count(*) as number_of_mints,
    sum(t.value/1e18) as total_sei_spent, -- assuming 18 decimals for SEI
    sum((t.value/1e18) * p.sei_price) as total_usd_spent,
    'NFT 1' as nft_category,
    case
    when e.origin_to_address = lower('{{NFT_1}}') then 'Seiyans'
    when e.origin_to_address = '{{NFT_2}}' then 'Drill Club'
    end as Collection
    FROM sei.core_evm.fact_event_logs e
    JOIN sei.core_evm.fact_transactions t
    ON e.tx_hash = t.tx_hash
    LEFT JOIN prices p
    ON date_trunc('hour', e.block_timestamp) = p.hour
    WHERE e.block_timestamp >= '2025-01-01'
    AND e.origin_to_address = lower('{{NFT_1}}')
    AND e.tx_status = 'SUCCESS'
    GROUP BY 5,6

    UNION ALL

    SELECT
    count(distinct e.origin_from_address) as unique_minters,
    count(*) as number_of_mints,
    sum(t.value/1e18) as total_sei_spent,
    sum((t.value/1e18) * p.sei_price) as total_usd_spent,
    Last run: about 2 months ago
    UNIQUE_MINTERS
    NUMBER_OF_MINTS
    TOTAL_SEI_SPENT
    TOTAL_USD_SPENT
    NFT_CATEGORY
    COLLECTION
    1
    40049600NFT 1Seiyans
    2
    152715700NFT 2Drill Club
    2
    69B
    7s