3

https://github.com/enjin/erc-1155/blob/master/contracts/ERC1155.sol says something about "operator approval".

What is an operator and what is operator approval?

1 Answer 1

5

The term operator has been first introduced by the EIP-721 to define addresses authorized (or approved) by a NFT owner to spend all of his token Ids.

In EIP-1155, the operator is set by the token owner thanks to the following function :

function setApprovalForAll(address _operator, bool _approved) external { operatorApproval[msg.sender][_operator] = _approved; emit ApprovalForAll(msg.sender, _operator, _approved); } 

Operators have the ability to manage all the tokens owned by the caller of the setApprovalForAll method.

Therefore, the safeTransferFrom and safeBatchTransferFrom methods can be called either by the token owner or one of his operators (note that an owner can have multiple operators). This statement is checked in both functions with the following line :

require(_from == msg.sender || operatorApproval[_from][msg.sender] == true, "Need operator approval for 3rd party transfers."); 
1
  • 1
    Why can an owner have multiple operators, but only single address defined in _tokenAPprovals? (refering to OpenZeppelin ERC-721 implementation) Commented Jan 11, 2022 at 14:17

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.