Skip to content

Latest commit

 

History

History
41 lines (26 loc) · 3.73 KB

participation-nfts.md

File metadata and controls

41 lines (26 loc) · 3.73 KB

How Participation NFTs Work

Introduction

In this post, we'll go over how the participation NFT feature works. Instead of providing a detailed description, we'll review the feature at a high level and give code pointers to the actual implementation.

Overview

Here's a simple breakdown of how the feature works:

  1. When listing a 1/1 NFT for auction, the creator can optionally attach a distinct participation NFT.
  2. Upon listing, the participation NFT will be minted as a master edition NFT with unlimited supply and transferred to an account owned by the Formfunction Gumdrop program.
  3. When the auction ends, an account owned by the Formfunction Gumdrop program is updated with a Merkle root that will allow each bidder to claim a participation NFT. Then, each bidder (including the winning bidder) can mint exactly one edition of the participation NFT by passing the correct Merkle proof to the program.
  4. After a few weeks, the master edition will be transferred back to the creator. After this point, bidders can no longer claim a participation NFT.

Check out this video for a more in-depth walkthrough.

Code Pointers

Program

The full program code is here.

  • When listing, new_distributor is called. This simply initializes an account called distributor.
  • After an auction is won, update_distributor is called in order to update the on-chain Merkle root.
  • Then, within some timespan (which can be configured), bidders can claim their participation NFT by calling claim_edition. This instruction takes a Merkle proof, which is validated against the Merkle root.
  • After some timespan, the Formfunction backend calls close_distributor_token_account, which returns the master edition to the creator, and close_distributor to reclaim rent.

Backend

  • When an auction is won, a Merkle root is stored on-chain so that all bidders of the auction can claim.
  • The code to process finished participation NFTs and return them to their owners is here.
  • Most information about participation NFTs is stored in the Claim table.

Frontend

  • The listing code is here.
  • Participation NFTs are displayed just like all other NFTs, using NftPage.tsx.
  • The code that displays participation NFTs on user profiles is here.