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);
}