0

link : https://stonk.industries/how-to-create-your-own-nft-using-the-opensea-creatures-template/

To Factory or not to Factory

that is the question This repo also includes a factory which is just another smart contract - the only purpose of which is to mint tokens. Deploying using a factory contract generally has higher upfront fees but costs less per-token to mint.

It also allows you to lazy mint, which means gas is due when each token is minted rather than upfront. The downside of lazy minting is users can't pick their token, they just get given the next available one. Using a factory contract doesn't mean you have to lazy mint - you could mint 50% and lazy mint the remainder, for example.

Personally I'd recommend using one, so that's what we're going to do in this tutorial, but I'll include a note on the alternative commands as we go.

I came across the above in the link.(https://stonk.industries/how-to-create-your-own-nft-using-the-opensea-creatures-template/)

It is said that gas cost is cheaper if function "mint" is executed through the factory.

But there is nothing about the reason and principle.

Can someone please explain..?

++ Looking at the factory smart contract code Opensea CreatureAccessoryFactory.sol, If you look at the "mint" function on line 113, it seems that the Mint function is just called with the ERC721 contract address.

Could this be the reason?

1 Answer 1

1

The benefit of using Opensea's Creature Factory is that you have the choice to mint one or multiple creatures at the same time by selecting the options that correspond to the optionId in the mint function in the CreatureFactory contract. That way if you want to mint multiple creatures, you can do it in one transaction, which could lower gas cost. In addition, the Creature Factory also allows lazy minting, which means you are allowed to defer the cost of minting an NFT until the moment your NFT is sold to its first buyer. The gas fees for minting are rolled into the same transaction that assigns the NFT to the buyer, so you never have to pay to mint. Instead, a portion of the purchase price simply goes to cover the additional gas needed to create the initial NFT record.

See:

https://github.com/ProjectOpenSea/opensea-creatures/blob/master/contracts/CreatureFactory.sol

https://nftschool.dev/tutorial/lazy-minting/#how-it-works

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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