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.
-
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 TLCommented May 15, 2022 at 9:10
-
Thank You, Can you answer this question as well ethereum.stackexchange.com/questions/128147/…– Syed Murtaza Ali ShahCommented May 15, 2022 at 9:13
Add a comment
|
1 Answer
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], "");
}
}