I'm looking to mint around 100 NFTs (or more if possible) in the constructor
of my smart-contract.
• During deployment I'm passing in an array of 100 ETH addresses to the constructor
, which then uses a for
loop to iterate through that array, minting one NFT to the current address from the Array, at each iteration. (This minting is happening by calling the standard _safeMint()
function from OpenZeppelin's ERC721 contract -- I'm using their contracts & libraries for this project.)
• I tried running all this on localhost
and its working great thus far - and I'll definitely be testing it on Ropsten and/or Goerli next. But of course we all know things can vary greatly when it comes to deploying on mainnet
.
So what I'd like to figure out is the following:
- What's the best way to estimate the actual COST of deploying this contract - and minting those 100 NFTs on mainnet?
- Is minting 100 NFTs in the constructor even possible - or is that already too much? Or, conversely, is 100 perfectly fine and I can actually push it to say 300, or even 500?
By the way, we do realize this isn't going to be cheap, but we're willing to take the hit, so it's really more about just what's technically possible in terms of block size - and what's not.
NOTE: I do also plan to have an additional stand-alone batchMint()
function in the contract that'll let us mint like say 30 NFTs at a time, again using a for
loop to call _safeMint()
- just so we have this as a backup.
In other words, if it turns out that we need to Mint a total of say 300 NFTs, but the Constructor can only handle minting 75 NFTs upon deployment, we'll then have the ability to manually call our batchMint()
function a bunch of times until we've finished minting all the NFTs the project needs.
But even here, we need to figure out what the limit is on how many NFTs can be minted in one for
loop each time we call our batchMint()
function.