2

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

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.");

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.