Skip to main content

ERC721 NFT Whitelist Sale

The ERC721 is a smart contract standard which is specialised in single-copy Non Fungible Tokens (NFT) and out-of-the-box compatible with Opensea. In an ERC721, every NFT is unique which means you have to reference the content for each NFT.

The smart contract template to sell NFTs only to selected users. In a video game, you can sell a piece of land only to players of an approved rank.

This Whitelist version enables you to create a whitelist of users that can buy your tokens through a Merkle tree.

This template enables you to mint a new token and sell it to your users. It helps you set up a sale, select when it starts and ends, and set a maximum number of tokens that can be sold in total or to the same user.

Notice that the baseURI of the ERC721 contract should be the URI that is linked to a directory on ipfs or your centralized server because when minting a new token, the URI will be added to the id. For example, https://ipfs.io/QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR/0

Parameters

  • definitiveTokenAddress: The token address of the ERC721 that you want to sell.
  • definitiveMerkleRoot: The root of the merkle tree that contains the list of the users that can buy the NFTs
  • definitivePrice: The price that the NFTs will be sold for.
  • definitiveStartTime: The time when the sale will begin and users can mint tokens.
  • definitiveEndTime: The time when the sale will end and users couldn't mint anymore tokens.
  • definitiveMaxTokensPerAddress: The maximum amount of tokens that can be minted by a single address.
  • definitiveMaxSupply: The maximum amount of tokens that can be minted during the sale.
  • definitiveFeeReceiver: The address that will receive all the price paid to mint the NFTs.

Functions

FunctionInput ParametersDescription
tokenNoneReturns the NFT contract where the new tokens will be minted at.
priceNoneReturns the price to mint one NFT in WEI.
startTimeNoneReturns the start time of the sale.
endTimeNoneReturns the end time of the sale.
maxTokensPerAddressNoneReturns the max number of tokens that a address can mint.
leftSupplyNoneThe left amount of token that can be minted during this sale.
tokensClaimed(address)The amount of token claimed per address
mint(address to)Mint a new token to a specific address from the token collection. Notice the minter must send the required amount defined by price.
mintBatch(address to, uint256 amount)Mint nth new tokens to a specific address from the token collection. Notice the minter must send the required amount defined by price times the amount of tokens minted.
withdrawNoneWithdraw the price paid for the mints
  • Parameters
  • Functions