3

In OpenZeppelin's ERC721 contract what was the design decision behind making _tokenapprovals a mapping, but _operatorApprovals a multidimensional mapping? Why restrict the ability to approve transfer of a single token, to only one address (_tokenapprovals), but create a data structure that gives multiple external addresses control over ALL account owned tokens (_operatorApprovals). What where the practical scenarios envisaged to arrive at this pattern?

2 Answers 2

2

This is a requirement of the ERC-721 standard.

  • Token approvals are a one-per-token data model.
  • Approvals-for-all are a one-per-operator-and
1

_tokenapprovals is related to the function approve andapprove is an approval specific to a tokenID

but

_operatorApprovals is related to the function setApprovalForAll and setApprovalForAll is for all tokenIds for a given ERC721 contract.

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.