opensea-creatures icon indicating copy to clipboard operation
opensea-creatures copied to clipboard

Why is MintNFT missing in scripts/mint.js file?

Open villarode opened this issue 3 years ago • 5 comments

Hi guys I am wondeing why something like:

mintNFT("https://gateway.pinata.cloud/ipfs/QmYueiuRNmL4MiA2GwtVMm6ZagknXnSpQnB3z2gWbz36hP");

is missing in this sample scripts/mint.js file? (I am just comparing OpenSea and Alchemy documentation)

Or does the line in the original cntract

function baseTokenURI() override public pure returns (string memory) { return "https:/gateway.pinata.cloud/ipfs/QmYqKdKrjPfD7KBqq7pkpaLCJdc4hzgcQWMHime5qcSgaE/"; }

do the job?) (per OpenSea documentation)

villarode avatar Nov 19 '21 16:11 villarode

Hello,

Our mint function for our Creatures smart contracts implement a similarly named method mintTo for the Creature contract and mint for the factory itself.

The mint.js script calls those methods here and here

michael-cohen-io avatar Nov 29 '21 12:11 michael-cohen-io

Hi, can I ask 2 questions:

  1. in our example NUM_CREATURES = 12, but all I can do as the owner of contract is to mint 1 token at a time to my address. Is there a way to specify say 5 creatures that I want to mint (somewhere in the WRITE CONTRACT section) and have them all minted in one go?

And

  1. I'm the owner of contract but I want to let my mate mint tokens to his wallet straight from WRITE section of the contract. Do I first approve his wallet in the 1st line in the WRITE section (which is Approve)?

Cheers!)

On Mon, 29 Nov 2021, 15:48 Michael Cohen, @.***> wrote:

Hello,

Our mint function for our Creatures smart contracts implement a similarly named method mintTo https://github.com/ProjectOpenSea/opensea-creatures/blob/master/contracts/ERC721Tradable.sol#L43 for the Creature contract and mint https://github.com/ProjectOpenSea/opensea-creatures/blob/master/contracts/CreatureFactory.sol#L77 for the factory itself.

The mint.js script calls those methods here https://github.com/ProjectOpenSea/opensea-creatures/blob/master/scripts/mint.js#L81 and here https://github.com/ProjectOpenSea/opensea-creatures/blob/master/scripts/mint.js#L89

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ProjectOpenSea/opensea-creatures/issues/155#issuecomment-981603155, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARYOXWXDCQCZHM3G53EP5A3UONZCBANCNFSM5IMPAGDA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

villarode avatar Dec 02 '21 01:12 villarode

Hey!

For the first question, I would implement some massMint() that calls mint() however much times needed:

function mint(uint amount, address to) public {
    for (uint i = 0; i < amount; i++) {
        mintTo(to);
    }
}

Unsure if this satisfies your exact needs based on your question but you can probably mess around a bit with the inputs to pass in an array of addresses to mint one asset to each address or something

For the second question, it sounds like you probably want to remove the mintTo() function's onlyOwner modifier. That modifier makes it so that only the contract owner (you) can call mintTo(). Typically contract developers will do this to prevent users from minting from outside of their specific website, but it sounds like functionality you're specifically looking for

michael-cohen-io avatar Dec 02 '21 01:12 michael-cohen-io

Thank you mate, much appreciated, all clear on question 1)) I was just thinking we had that massMint function already, that's what confused me...

Regarding the 2nd question. What I meant is say I have a protégé)) I want to approve on my whitelist and mint him a token. I the owner will be minting for him, not him for himself.

Do I need to go to WRITE section of the contract, go to 1st line (approve), first approve his wallet (whitelist him) and then go down to do minting for him as if I were doing it for myself?)

And one more thing. If I am willing to whitelist him and mint him a token at a price, where do I incorporate that fixed price in our mint.js file?)

Thanks a lot mate cheers for your help!)

On Thu, 2 Dec 2021, 04:35 Michael Cohen, @.***> wrote:

Hey!

For the first question, I would implement some massMint() that calls mint() however much times needed:

function mint(uint amount, address to) public { for (uint i = 0; i < amount; i++) { mintTo(to); } }

Unsure if this satisfies your exact needs based on your question but you can probably mess around a bit with the inputs to pass in an array of addresses to mint one asset to each address or something

For the second question, it sounds like you probably want to remove the mintTo() function's onlyOwner modifier. That modifier makes it so that only the contract owner (you) can call mintTo(). Typically contract developers will do this to prevent users from minting from outside of their specific website, but it sounds like functionality you're specifically looking for

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ProjectOpenSea/opensea-creatures/issues/155#issuecomment-984212296, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARYOXWQGTWRV2YCWTN2T7HDUO3EODANCNFSM5IMPAGDA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

villarode avatar Dec 02 '21 10:12 villarode

@villarode Some information that may be useful to you You can reserve an item for a Specific Buyer too. https://support.opensea.io/hc/en-us/articles/360063498333-How-do-I-sell-an-NFT-

humanwhoexplores avatar Jan 20 '22 17:01 humanwhoexplores