Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
openzeppelin-contracts-upgradeable
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
俞永鹏
openzeppelin-contracts-upgradeable
Commits
4e2641a9
Unverified
Commit
4e2641a9
authored
Jul 13, 2021
by
Anton Bukov
Committed by
GitHub
Jul 13, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify selector access (#2766)
parent
973b0f88
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
5 deletions
+5
-5
ERC1155.sol
contracts/token/ERC1155/ERC1155.sol
+2
-2
ERC721.sol
contracts/token/ERC721/ERC721.sol
+1
-1
SignatureChecker.sol
contracts/utils/cryptography/SignatureChecker.sol
+1
-1
ERC165Checker.sol
contracts/utils/introspection/ERC165Checker.sol
+1
-1
No files found.
contracts/token/ERC1155/ERC1155.sol
View file @
4e2641a9
...
...
@@ -408,7 +408,7 @@ contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
) private {
if (to.isContract()) {
try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {
if (response != IERC1155Receiver
(to)
.onERC1155Received.selector) {
if (response != IERC1155Receiver.onERC1155Received.selector) {
revert("ERC1155: ERC1155Receiver rejected tokens");
}
} catch Error(string memory reason) {
...
...
@@ -431,7 +431,7 @@ contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (
bytes4 response
) {
if (response != IERC1155Receiver
(to)
.onERC1155BatchReceived.selector) {
if (response != IERC1155Receiver.onERC1155BatchReceived.selector) {
revert("ERC1155: ERC1155Receiver rejected tokens");
}
} catch Error(string memory reason) {
...
...
contracts/token/ERC721/ERC721.sol
View file @
4e2641a9
...
...
@@ -374,7 +374,7 @@ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
) private returns (bool) {
if (to.isContract()) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver
(to)
.onERC721Received.selector;
return retval == IERC721Receiver.onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert("ERC721: transfer to non ERC721Receiver implementer");
...
...
contracts/utils/cryptography/SignatureChecker.sol
View file @
4e2641a9
...
...
@@ -24,7 +24,7 @@ library SignatureChecker {
) internal view returns (bool) {
if (Address.isContract(signer)) {
try IERC1271(signer).isValidSignature(hash, signature) returns (bytes4 magicValue) {
return magicValue == IERC1271
(signer)
.isValidSignature.selector;
return magicValue == IERC1271.isValidSignature.selector;
} catch {
return false;
}
...
...
contracts/utils/introspection/ERC165Checker.sol
View file @
4e2641a9
...
...
@@ -104,7 +104,7 @@ library ERC165Checker {
* Interface identification is specified in ERC-165.
*/
function _supportsERC165Interface(address account, bytes4 interfaceId) private view returns (bool) {
bytes memory encodedParams = abi.encodeWithSelector(IERC165
(account)
.supportsInterface.selector, interfaceId);
bytes memory encodedParams = abi.encodeWithSelector(IERC165.supportsInterface.selector, interfaceId);
(bool success, bytes memory result) = account.staticcall{gas: 30000}(encodedParams);
if (result.length < 32) return false;
return success && abi.decode(result, (bool));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment