I'd like to mint 100 NFTs saving gas.
I'm a super beginner about solidity so might ask you easy questions.
I use ipfs for metadata like 'ipfs://QmXXXXXXXXXXXXXX/1.json' ... 'ipfs://QmXXXXXXXXXXXXXX/100.json', and Mainnet in Opensea, not Polygon.
I already tried two ways:
-
Mint 100 NFTs using ERC721
This was a success, except for the high gas prices. As I told you earlier, I am a beginner so I just watched this great Youtube and did it with this code. He is amazing. However, the cost of gas is still too high, so I looked for other ways to do it and realized that BatchMinting with ERC1155 would be a good idea. -
Mint 100 NFTs using ERC1155
This was a success, if only in terms of gas prices, much cheaper than minting with ERC721. However I ran into a major problem. The code below is the code I wrote.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC1155/ERC1155.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Strings.sol";
contract TestERC1155 is ERC1155 {
uint256 public maxMintAmount = 100;
string public name;
string public symbol;
constructor() ERC1155("ipfs://XXXXXXXXXXXXXXXXXXXX/{id}.json") {
name = "testERC1155";
symbol = "TERC1155";
for (uint256 i = 1; i <= maxMintAmount; i++) {
_mint(msg.sender, i, 1, "");
}
}
function uri(uint256 _tokenId) public view virtual override returns (string memory) {
return string(abi.encodePacked("ipfs://XXXXXXXXXXXXXXXXXXXX/", Strings.toString(_tokenId), ".json"));
}
}
This code makes it impossible to edit collections and assets on opensensea. For some reason, there is no Edit button. I don't know why. Also, it doesn't have various functions like the first Youtube code.
Any ideas? Thank you!