Skip to main content

Overview

This example shows how NFT marketplaces can integrate ZKScore to track trading activity, verify collectors, and reward marketplace participation.

NFT Marketplace Integration

class NFTMarketplaceIntegration {
  constructor(marketplace, zkScoreContracts) {
    this.marketplace = marketplace;
    this.zkScore = zkScoreContracts;
  }
  
  async trackNFTPurchase(buyer, seller, nftAddress, tokenId, price) {
    // Record trade
    await this.marketplace.executeTrade(buyer, seller, nftAddress, tokenId, price);
    
    // Update buyer's NFT score
    await this.zkScore.scoreCalculator.updateCategoryScore(buyer, 1, price / 100);
    
    // Check collector achievements
    const nftCount = await this.marketplace.getUserNFTCount(buyer);
    if (nftCount >= 10) {
      await this.zkScore.achievementRegistry.claimAchievement(200, '0x'); // NFT Collector
    }
  }
}

Best Practices

  1. Track All Trades: Update scores for every transaction
  2. Buyer & Seller: Track both sides of trades
  3. Collection Diversity: Reward diverse collecting
  4. Rarity Tracking: Higher scores for rare NFTs