Following the Moralis tutorial (https://www.youtube.com/watch?v=FcH7qXnOgzs&list=RDCMUCgWS9Q3P5AxCWyQLT2kQhBw) I’m trying to deploy this contract (remix.ethereum.org):
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// Import 1155 token contract from Openzeppelin
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/math/SafeMath.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol";
// Contract to be deployed via https://remix.ethereum.org/
contract NFTContract is ERC1155, Ownable {
using SafeMath for uint256;
uint256 public count = 1000; // Number of files to mint
constructor() ERC1155("ipfs://<FOLDER_HASH>/<SUBFOLDER_NAME>/{id}.json") {
for (uint256 i = 1; i <= count; i++) {
mint(msg.sender, i, 1);
}
}
function mint(address account, uint256 id, uint256 amount) public onlyOwner {
_mint(account, id, amount, "");
}
function burn(address account, uint256 id, uint256 amount) public {
require(msg.sender == account);
_burn(account, id, amount);
}
}
The json files names are:
<FOLDER_HASH>/<SUBFOLDER_NAME>/0000000000000000000000000000000000000000000000000000000000000001.json
...
<FOLDER_HASH>/<SUBFOLDER_NAME>/0000000000000000000000000000000000000000000000000000000000001000.json
But the deployment seems to be stuck… it’s been over 30 minutes now. I am doing it right?
or should I write a 1000 lines instead of use a loop?
mint(msg.sender, 1, 1);
mint(msg.sender, 2, 1);
...
mint(msg.sender, 999, 1);
mint(msg.sender, 1000, 1);
If I try to do it with 1000 lines (instead of a loop) I get this error:
Oh my God… is this imposible to do? Help!