Compose aim for onchain readability, with that in mind I want to propose some change on the current ERC 721 parameter naming in approval function.
The parameter name _approved is used in both approve and setApprovalForAll but it is represent two different data types (address and boolean):
function approve(address _approved, uint256 _tokenId) external {
...
@> s.approved[_tokenId] = _approved;
emit Approval(owner, _approved, _tokenId);
}
function setApprovalForAll(address _operator, bool _approved) external {
if (_operator == address(0)) {
revert ERC721InvalidOperator(_operator);
}
@> getStorage().isApprovedForAll[msg.sender][_operator] = _approved;
emit ApprovalForAll(msg.sender, _operator, _approved);
}
Recommendation:
_approved used for boolean parameter. (no change in current implementation of setApprovalForAll)
_operator or _to is used for address parameter. this is the only change. affect only the approve function
Note: this deviate from EIP-721 interface examples, but it does not necessarily became non-compliant
Compose aim for onchain readability, with that in mind I want to propose some change on the current ERC 721 parameter naming in approval function.
The parameter name
_approvedis used in bothapproveandsetApprovalForAllbut it is represent two different data types (address and boolean):Recommendation:
_approvedused for boolean parameter. (no change in current implementation ofsetApprovalForAll)_operatoror_tois used for address parameter. this is the only change. affect only theapprovefunctionNote: this deviate from EIP-721 interface examples, but it does not necessarily became non-compliant