From fbf235661e01e27275302302b86271a8ec136fea Mon Sep 17 00:00:00 2001 From: Aleksei Magusev <248290+lexmag@users.noreply.github.com> Date: Mon, 25 Jul 2022 13:01:14 -0700 Subject: [PATCH] Improve grammar in transfer error messages (#3542) --- contracts/token/ERC1155/ERC1155.sol | 4 ++-- contracts/token/ERC1155/extensions/ERC1155Burnable.sol | 4 ++-- contracts/token/ERC721/ERC721.sol | 6 +++--- contracts/token/ERC721/extensions/ERC721Burnable.sol | 2 +- contracts/utils/introspection/IERC1820Registry.sol | 2 +- test/token/ERC1155/ERC1155.behavior.js | 4 ++-- test/token/ERC1155/extensions/ERC1155Burnable.test.js | 4 ++-- test/token/ERC721/ERC721.behavior.js | 6 +++--- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/contracts/token/ERC1155/ERC1155.sol b/contracts/token/ERC1155/ERC1155.sol index 9e8f79ed7..237e8ba94 100644 --- a/contracts/token/ERC1155/ERC1155.sol +++ b/contracts/token/ERC1155/ERC1155.sol @@ -123,7 +123,7 @@ contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI { ) public virtual override { require( from == _msgSender() || isApprovedForAll(from, _msgSender()), - "ERC1155: caller is not token owner nor approved" + "ERC1155: caller is not token owner or approved" ); _safeTransferFrom(from, to, id, amount, data); } @@ -140,7 +140,7 @@ contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI { ) public virtual override { require( from == _msgSender() || isApprovedForAll(from, _msgSender()), - "ERC1155: caller is not token owner nor approved" + "ERC1155: caller is not token owner or approved" ); _safeBatchTransferFrom(from, to, ids, amounts, data); } diff --git a/contracts/token/ERC1155/extensions/ERC1155Burnable.sol b/contracts/token/ERC1155/extensions/ERC1155Burnable.sol index c82ee41fd..83f6e3d58 100644 --- a/contracts/token/ERC1155/extensions/ERC1155Burnable.sol +++ b/contracts/token/ERC1155/extensions/ERC1155Burnable.sol @@ -19,7 +19,7 @@ abstract contract ERC1155Burnable is ERC1155 { ) public virtual { require( account == _msgSender() || isApprovedForAll(account, _msgSender()), - "ERC1155: caller is not token owner nor approved" + "ERC1155: caller is not token owner or approved" ); _burn(account, id, value); @@ -32,7 +32,7 @@ abstract contract ERC1155Burnable is ERC1155 { ) public virtual { require( account == _msgSender() || isApprovedForAll(account, _msgSender()), - "ERC1155: caller is not token owner nor approved" + "ERC1155: caller is not token owner or approved" ); _burnBatch(account, ids, values); diff --git a/contracts/token/ERC721/ERC721.sol b/contracts/token/ERC721/ERC721.sol index c6246c3e6..f457cef5e 100644 --- a/contracts/token/ERC721/ERC721.sol +++ b/contracts/token/ERC721/ERC721.sol @@ -115,7 +115,7 @@ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), - "ERC721: approve caller is not token owner nor approved for all" + "ERC721: approve caller is not token owner or approved for all" ); _approve(to, tokenId); @@ -153,7 +153,7 @@ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length - require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner nor approved"); + require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved"); _transfer(from, to, tokenId); } @@ -178,7 +178,7 @@ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { uint256 tokenId, bytes memory data ) public virtual override { - require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner nor approved"); + require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved"); _safeTransfer(from, to, tokenId, data); } diff --git a/contracts/token/ERC721/extensions/ERC721Burnable.sol b/contracts/token/ERC721/extensions/ERC721Burnable.sol index 27756483b..e2d96814d 100644 --- a/contracts/token/ERC721/extensions/ERC721Burnable.sol +++ b/contracts/token/ERC721/extensions/ERC721Burnable.sol @@ -20,7 +20,7 @@ abstract contract ERC721Burnable is Context, ERC721 { */ function burn(uint256 tokenId) public virtual { //solhint-disable-next-line max-line-length - require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner nor approved"); + require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved"); _burn(tokenId); } } diff --git a/contracts/utils/introspection/IERC1820Registry.sol b/contracts/utils/introspection/IERC1820Registry.sol index dcc346ebc..8006117c8 100644 --- a/contracts/utils/introspection/IERC1820Registry.sol +++ b/contracts/utils/introspection/IERC1820Registry.sol @@ -107,7 +107,7 @@ interface IERC1820Registry { function implementsERC165Interface(address account, bytes4 interfaceId) external view returns (bool); /** - * @notice Checks whether a contract implements an ERC165 interface or not without using nor updating the cache. + * @notice Checks whether a contract implements an ERC165 interface or not without using or updating the cache. * @param account Address of the contract to check. * @param interfaceId ERC165 interface to check. * @return True if `account` implements `interfaceId`, false otherwise. diff --git a/test/token/ERC1155/ERC1155.behavior.js b/test/token/ERC1155/ERC1155.behavior.js index 3ac4c3462..62ba66677 100644 --- a/test/token/ERC1155/ERC1155.behavior.js +++ b/test/token/ERC1155/ERC1155.behavior.js @@ -293,7 +293,7 @@ function shouldBehaveLikeERC1155 ([minter, firstTokenHolder, secondTokenHolder, this.token.safeTransferFrom(multiTokenHolder, recipient, firstTokenId, firstAmount, '0x', { from: proxy, }), - 'ERC1155: caller is not token owner nor approved', + 'ERC1155: caller is not token owner or approved', ); }); }); @@ -569,7 +569,7 @@ function shouldBehaveLikeERC1155 ([minter, firstTokenHolder, secondTokenHolder, [firstAmount, secondAmount], '0x', { from: proxy }, ), - 'ERC1155: caller is not token owner nor approved', + 'ERC1155: caller is not token owner or approved', ); }); }); diff --git a/test/token/ERC1155/extensions/ERC1155Burnable.test.js b/test/token/ERC1155/extensions/ERC1155Burnable.test.js index caa4d1648..ff6aee054 100644 --- a/test/token/ERC1155/extensions/ERC1155Burnable.test.js +++ b/test/token/ERC1155/extensions/ERC1155Burnable.test.js @@ -36,7 +36,7 @@ contract('ERC1155Burnable', function (accounts) { it('unapproved accounts cannot burn the holder\'s tokens', async function () { await expectRevert( this.token.burn(holder, tokenIds[0], amounts[0].subn(1), { from: other }), - 'ERC1155: caller is not token owner nor approved', + 'ERC1155: caller is not token owner or approved', ); }); }); @@ -60,7 +60,7 @@ contract('ERC1155Burnable', function (accounts) { it('unapproved accounts cannot burn the holder\'s tokens', async function () { await expectRevert( this.token.burnBatch(holder, tokenIds, [ amounts[0].subn(1), amounts[1].subn(2) ], { from: other }), - 'ERC1155: caller is not token owner nor approved', + 'ERC1155: caller is not token owner or approved', ); }); }); diff --git a/test/token/ERC721/ERC721.behavior.js b/test/token/ERC721/ERC721.behavior.js index c13bc1e42..021398449 100644 --- a/test/token/ERC721/ERC721.behavior.js +++ b/test/token/ERC721/ERC721.behavior.js @@ -188,7 +188,7 @@ function shouldBehaveLikeERC721 (errorPrefix, owner, newOwner, approved, another it('reverts', async function () { await expectRevert( transferFunction.call(this, owner, other, tokenId, { from: other }), - 'ERC721: caller is not token owner nor approved', + 'ERC721: caller is not token owner or approved', ); }); }); @@ -505,7 +505,7 @@ function shouldBehaveLikeERC721 (errorPrefix, owner, newOwner, approved, another context('when the sender does not own the given token ID', function () { it('reverts', async function () { await expectRevert(this.token.approve(approved, tokenId, { from: other }), - 'ERC721: approve caller is not token owner nor approved'); + 'ERC721: approve caller is not token owner or approved'); }); }); @@ -513,7 +513,7 @@ function shouldBehaveLikeERC721 (errorPrefix, owner, newOwner, approved, another it('reverts', async function () { await this.token.approve(approved, tokenId, { from: owner }); await expectRevert(this.token.approve(anotherApproved, tokenId, { from: approved }), - 'ERC721: approve caller is not token owner nor approved for all'); + 'ERC721: approve caller is not token owner or approved for all'); }); });