In most ERC721 setApprovalForAll()
implementations, to revoke approval, the mapping is set to 0, instead of deleting the entry. I wonder what happens if many users have many approvals revoked, wouldn't deleting save a lot of storage in the mapping?
To put it into code, it would look like I have a mapping:
mapping(address => mapping(address => bool)) private _operatorApprovals;
What is the difference between delete _operatorApprovals[owner][operator];
and _operatorApprovals[owner][operator] = 0;
Thank you in advance.
Update/Answer
delete
is the same as setting to default value. StackExchange.mapping
does not keep track of the keys, nor does it have a length. Medium.