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

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, privacy policy and cookie policy

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