Error when Minting an ERC1155

I have managed to deploy my ERC1155 contract successfully using remix.
However when I try to mint the token using for example

account: 0x702874002cAA56b8f66587689eBD36e278f3d9d8
id: 0
amount: 10

Nothing entered for data but I get the same whatever I seem to try.

I am getting the following error

transact to errored: Error encoding arguments: Error: invalid arrayify value (argument="value", value="", code=INVALID_ARGUMENT, version=bytes/5.5.0)

Any help with this would be greatly appreciated.


The code I am using

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol";
import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol";

contract CPTURI is ERC1155, Ownable, ERC1155Burnable, ERC1155Supply {

    function setURI(string memory newuri) public onlyOwner {

    function mint(address account, uint256 id, uint256 amount, bytes memory data)
        _mint(account, id, amount, data);

    function mintBatch(address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data)
        _mintBatch(to, ids, amounts, data);

    // The following functions are overrides required by Solidity.

    function _beforeTokenTransfer(address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data)
        override(ERC1155, ERC1155Supply)
        super._beforeTokenTransfer(operator, from, to, ids, amounts, data);

The problem is that you populate the data parameter with a string argument, even if it's just an empty string, whereas it only accepts bytes values. Remix only accepts a bytes value as valid if it has the "0x" prefix.

When trying to call mint, if your intention is to send empty data, send the value "0x" instead, it will be recognized as a valid bytes value.

Brilliant! Thanks Julissa that has worked.

What is data parameter used for?

Thanks again


Dear, @rob_jones
I think the issue is account.
Please check if this address is owner address of smart contract.
As fourth parameter, you can enter empty string.
Kind regards.

Here is Milo Point from Canada.
The main point could be your account.
Owner address of Smart contract would be 0x702874002cAA56b8f66587689eBD36e278f3d9d8