0

How is it possible for an NFT to be minted by a different address than the address who is that NFT's creator?

Here is an example: Minted by Sam, Created by the Collection

Where in the smart contract deployer can the minted by and created by fields be viewed in code, and how are they invoked differently?

1 Answer 1

1

Upon creation of the NFT smart contract the developer has a loop in the constructor (or later), that loops though the contracts indices for and assigns each token to the owner address instead of the default zero address (uninitialized variables, in this case mapping, are initialized to zero).

The developer will have to pay the extra gas for each of these changes in state, but enable the developer to more easily conduct giveaways and the like. Although, the more common practice is only mint a select supply for giveaways, not the whole collection.

Here's an example of such a constructor:

constructor(string memory baseURI, uint collectionSize) ERC721("Name", "Symobol") public { 
    setBaseURI(baseURI);
    
    while (collectionSize > 0) {
        uint mintIndex = totalSupply();
        _safeMint(msg.sender, mintIndex);
        _setTokenURI(mintIndex, "if applicable");
        collectionSize--;
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.