DEV Community

Discussion on: Deploy NFTs with Truffle, IPFS OpenSea & Polygon

Collapse
 
drjacky profile image
Hossein Abbasi

Nice article!
Could we upload new NFTs to the existing collection?

Collapse
 
drjacky profile image
Hossein Abbasi

And my second question is,
Is that possible to list them while we're uploading them?

Collapse
 
yournewempire profile image
Archie Smyth

Hello Hossein.

I have had a quick search in the IPFS forums and it looks like there are possible ways of doing this, but my knowledge with IPFS CLI is very little, albeit I used Pinata as third-party in this tutorial.

What I would do is override the virtual _baseURI() function from the inherited ERC-721 contracts, but importantly, have it return a variable. This variable would be have to be added to the NFT contract and should be mutated with a 'setBaseURI' function. Then, one would upload a new folder to IPFS with added content, and update the base URI with the new 'setBaseURI' function. With that, the mintItem function I wrote should be rewritten so that, you would not need to pass a URI string to every mint, and instead it just mints with the token ID. Then when you want token metadata from the inherited tokenURI function, it will conditionally check if there is a baseURI and if so, just return the baseURI concatenated with the ID.

I would recommend inspecting the ERC721URIStorage.sol and ERC721.sol files and all of the methods as I have done, and then finding a way around these kind of situations.

Have a look at this great article by Rounak Banik where this is actually implemented.

I hope I answered the question to a good standard.

Collapse
 
drjacky profile image
Hossein Abbasi

I use ERC1155. So, I need to figure it out somehow.

And do you have the answer for my second question? "Is that possible to list them while we're uploading them?"

Thanks!

Thread Thread
 
yournewempire profile image
Archie Smyth

Oh sorry I missed that one. Have a look at Benm4nn's comments on this discussion. We were talking about the fact that OpenSea.js SDK does not support Polygon listings at this time. Which leads us to listing the items on OpenSea's front end. I have been looking around for a solution, still nothing other than listing old school. Best of luck finding a solution.

Thread Thread
 
yournewempire profile image
Archie Smyth

Hi again Hossein. The best solution for this listing problem would be writing a minter function and a constant variable for price of payable mint function.