I have a function in an ERC1155 contract that looks like this:

function foo(uint _id, uint _amm) external{
    safeTransferFrom(address(this), msg.sender, _id, _amm, "");

Assume the contract does in fact have the tokens it's attempting to send as it does in the real non-simplified code.

Also I have the onERC1155Received and onERC1155BatchReceived functions copied over from the Open Zeppelin holder code here:


And yet, remix reverts the function because it doesn't have approval to send the tokens. But it's sending it from itself. Anything I am missing here? I'm assuming it has to do with the holding code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.