1

E.G: 1-NFT minted sent to 1-person, But in a broader perspective. e.g: 100 NFT's to 100 people, In the same function using ERC1155. I want to mint and transfer those 100 nfts in the same function. To send multiple nfts to multiple addresses.

2
  • You can do that , you need to write a new function that call mint and transfer N-Time :/? You need to check how much that cost and maybe call that function multiple time to avoid out of gas or block limit
    – Majd TL
    Commented May 15, 2022 at 9:10
  • Thank You, Can you answer this question as well ethereum.stackexchange.com/questions/128147/… Commented May 15, 2022 at 9:13

1 Answer 1

1

This function receives and array of target addresses, an array of ids and an array of amounts. It should work well in your erc1155 contract.

function massMint(address[] memory _to, uint256[] memory _ids, uint256[] memory _amounts)
    external
    onlyOwner
{
    for (uint256 i = 0; i < _to.length; ++i) {
        _mint(_to[i], _ids[i], _amounts[i], "");
    }
}

Your Answer

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

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