Study NFT minting code — Azuki, the ancestor of ERC721A

Shirley
Coinmonks

--

I primarily review the overall workflow of minting NFT and the Azuki code. I won’t dive into how ERC721A works and why it saves the gas of minting in this article.

The selling logic of minting NFT (ideally)

workflow of the NFT minting
workflow of the NFT minting
  • Set up a bunch of sale information at least before the auction mint.
  • The sale info can be updated anytime.
  • Set whitelisted addresses at least before the allowlist mint.
  • Whitelists can be added later.

Split the code of Azuki

Some configuration and modifier

Constructor

maxBatchSize

  • defining the maximum NFT a minter can mint in _safeMint() in ERC721A
  • using in ownershipOf() to check tokenId of the owner in ERC721A
  • amount of devMint() needed to be a multiply of it
  • the maximum of NFT every address when auction mint and public sale

Snippet of ERC721A about maxBatchSize

Free mint (for marketing etc)

Auction mint and set up information of sale after the auction

Whitelist Mint

Public sale mint

Base URI and some other functions

Overall Review

The overall review of Azuki code is here.

Hope it’s helpful.

--

--

Shirley
Coinmonks

The luxury of learning is the best gift I could've ever received 🎁|twitter.com/arealclimber