Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rename ERC1155InsufficientApprovalForAll to `ERC1155MissingApproval…
…ForAll` (#4381)
  • Loading branch information
ernestognw committed Jun 29, 2023
commit 71cd6ba38e98bc66516e35a428b06ead09ecd5db
2 changes: 1 addition & 1 deletion contracts/interfaces/draft-IERC6093.sol
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ interface IERC1155Errors {
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param owner Address of the current owner of a token.
*/
error ERC1155InsufficientApprovalForAll(address operator, address owner);
error ERC1155MissingApprovalForAll(address operator, address owner);

/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
Expand Down
4 changes: 2 additions & 2 deletions contracts/token/ERC1155/ERC1155.sol
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ abstract contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI, IER
*/
function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes memory data) public virtual {
if (from != _msgSender() && !isApprovedForAll(from, _msgSender())) {
revert ERC1155InsufficientApprovalForAll(_msgSender(), from);
revert ERC1155MissingApprovalForAll(_msgSender(), from);
}
_safeTransferFrom(from, to, id, amount, data);
}
Expand All @@ -132,7 +132,7 @@ abstract contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI, IER
bytes memory data
) public virtual {
if (from != _msgSender() && !isApprovedForAll(from, _msgSender())) {
revert ERC1155InsufficientApprovalForAll(_msgSender(), from);
revert ERC1155MissingApprovalForAll(_msgSender(), from);
}
_safeBatchTransferFrom(from, to, ids, amounts, data);
}
Expand Down
4 changes: 2 additions & 2 deletions contracts/token/ERC1155/extensions/ERC1155Burnable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ import "../ERC1155.sol";
abstract contract ERC1155Burnable is ERC1155 {
function burn(address account, uint256 id, uint256 value) public virtual {
if (account != _msgSender() && !isApprovedForAll(account, _msgSender())) {
revert ERC1155InsufficientApprovalForAll(_msgSender(), account);
revert ERC1155MissingApprovalForAll(_msgSender(), account);
}

_burn(account, id, value);
}

function burnBatch(address account, uint256[] memory ids, uint256[] memory values) public virtual {
if (account != _msgSender() && !isApprovedForAll(account, _msgSender())) {
revert ERC1155InsufficientApprovalForAll(_msgSender(), account);
revert ERC1155MissingApprovalForAll(_msgSender(), account);
}

_burnBatch(account, ids, values);
Expand Down
4 changes: 2 additions & 2 deletions test/token/ERC1155/ERC1155.behavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ function shouldBehaveLikeERC1155([minter, firstTokenHolder, secondTokenHolder, m
this.token.safeTransferFrom(multiTokenHolder, recipient, firstTokenId, firstAmount, '0x', {
from: proxy,
}),
'ERC1155InsufficientApprovalForAll',
'ERC1155MissingApprovalForAll',
[proxy, multiTokenHolder],
);
});
Expand Down Expand Up @@ -609,7 +609,7 @@ function shouldBehaveLikeERC1155([minter, firstTokenHolder, secondTokenHolder, m
'0x',
{ from: proxy },
),
'ERC1155InsufficientApprovalForAll',
'ERC1155MissingApprovalForAll',
[proxy, multiTokenHolder],
);
});
Expand Down
4 changes: 2 additions & 2 deletions test/token/ERC1155/extensions/ERC1155Burnable.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ contract('ERC1155Burnable', function (accounts) {
it("unapproved accounts cannot burn the holder's tokens", async function () {
await expectRevertCustomError(
this.token.burn(holder, tokenIds[0], amounts[0].subn(1), { from: other }),
'ERC1155InsufficientApprovalForAll',
'ERC1155MissingApprovalForAll',
[other, holder],
);
});
Expand All @@ -63,7 +63,7 @@ contract('ERC1155Burnable', function (accounts) {
it("unapproved accounts cannot burn the holder's tokens", async function () {
await expectRevertCustomError(
this.token.burnBatch(holder, tokenIds, [amounts[0].subn(1), amounts[1].subn(2)], { from: other }),
'ERC1155InsufficientApprovalForAll',
'ERC1155MissingApprovalForAll',
[other, holder],
);
});
Expand Down