1

I am facing an issue when i am trying to give approval to the operator to burn my token in ERC1155. The issue is i want only to give access to the particular token id with a particular amount. But ERC1155 standard gives only one method i.e setApprovalForAll() which allow operator to access all my assets.

function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC1155: setting approval status for self"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } 

I just want to give him access for particular token ID like ERC721 approve(address to, uint256 tokenId) method gives to us.

/** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } 

1 Answer 1

1

For your use case, I think you should create ERC721 contract cause IERC1155 doesn't have any core approve() function . It only consists of a setapprovalfor all() function. https://docs.openzeppelin.com/contracts/3.x/api/token/erc1155

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.