0

I'm trying to do

abi.encodeWithSignature(
                "mint(address, string **memory**)",
                receiverAddress,
                tokenURI
            )

The function definition is like this:

function mint(address to, string memory tokenURI) public {
        _safeMint(to, tokenId);
        _setTokenURI(tokenId, tokenURI);
        unchecked {
            tokenId++;
        }
    }

Do I need to add memory keyword while encoding or not? It will be a great help if someone can explain me that. Thanks in advance.

1 Answer 1

0

You don’t need to add memory keyword. Also, you’ve to remove any spaces.

So, it should be:

abi.encodeWithSignature(
                "mint(address,string)",
                receiverAddress,
                tokenURI
            );
2
  • 1
    Thank you very much, especially for going one step ahead and suggesting removal of whitespaces. Commented May 11 at 8:24
  • You’re welcome, Mayank. Kindly please accept the answer, if it helped you. Happy coding! Commented May 11 at 8:39

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.