Lets say I want to mint 1000 NFT's same image but their name is numbered 1-1000. Is it better to set a max supply of 1000, or to run the mint function 1000 times?
1 Answer
It depends on the Standard you are using.
With ERC721
tokens a batch mint is not possible (so you would have to call the mint(...)
function 1000 times), however if your contract uses the ERC1155
standard, you can use the function _mintBatch(address to, uint256[] ids, uint256[] amounts, bytes data)
. You can read more about the function here.
Note though that the function is an internal
function, so you have to expose it by wrapping it in a custom function, and probably add some custom logic to when the caller is allowed to batch mint.
Also this answer assumes that you are using @openzeppelin/contracts
for a safe implementation.