I'm trying to create an ERC-1155 token and I'm using the method _mintBatch
_mintBatch(address to, uint256[] ids, uint256[] amounts, bytes data)
and it has a parameter
bytes data
that I have no idea what it's used for
It doesn't say what I need to use there in the documentation
What am I supposed to fill in for that parameter?
Well, I've always just passed 0x
or ""
in the data parameter and everything works fine. As for the contract why it has the data parameter, it doesn’t use the data parameter but passes it on. If you needed to pass additional data for mint
and transfers
then you could use data
.
if you go down into the rabbit hole in the git repo, You can see in the last of the _batchmint
function that _afterTokenTransfer
is called. It is used in nearly all other major functions. It is called solidity hooks.
maybe you want to emit a separate event in the hook for the data or something. It really depends.
You can read more about hooks here in the oppenzepplin docs.