-2

Is it possible to create many ERC721 tokens at a time? I saw this link. ERC721 - Create 1000 tokens in one function call But I don't get it. Please help me.

1
  • My answer on that question includes a code sample. What did you try? What code are you using? -- Downvoting as this question does not show any effort or contribute anything to the discussion. Sep 4, 2019 at 3:39

2 Answers 2

2

Yes you can create many ERC721 tokens at a time, however, the amount of tokens that you can create from a single function call is dependant on the gas cost of your transaction. If your transaction costs more than the gas limit i.e. approx 8000000 then your function will not be successful.

1

Yes you can, with the use of clone contract ERC-1167. Here is an simple example that i have written times ago:

function mint(uint256 _numberOfToken) public onlyOwner returns(address[] memory) {
  require(_numberOfToken < 30);
  address[] memory output = new address[](_numberOfToken);
  for(int i = 0; i < _numberOfToken; i++) {
    returnAddress[i] = createClone(YOUR_CORE_ERC721_ADDRESS_HERE);
  }
  emit createNewToken(returnAddress)
  return returnAddress;
}

with createClone function is take from ERC1167 implementation

So in the idea in general first you deploy your main ERC721 and deploy another contract which create clones from your main ERC721. When you want to create many new ERC721 you just call that contract and get the return value.

Btw the reason i put 30 as maxium is because this function cost a lot of gas and if like an user try to call for 100 then the code is gonna break so i just want a call to just have 30 token at maxium.

Your Answer

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

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