Update docs
This commit is contained in:
@ -15,3 +15,12 @@ contract ERC1271WalletMock is Ownable, IERC1271 {
|
||||
return ECDSA.recover(hash, signature) == owner() ? this.isValidSignature.selector : bytes4(0);
|
||||
}
|
||||
}
|
||||
|
||||
contract ERC1271MaliciousMock is IERC1271 {
|
||||
function isValidSignature(bytes32, bytes memory) public pure override returns (bytes4) {
|
||||
assembly {
|
||||
mstore(0, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
|
||||
return(0, 32)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
12
contracts/mocks/ERC165/ERC165MaliciousData.sol
Normal file
12
contracts/mocks/ERC165/ERC165MaliciousData.sol
Normal file
@ -0,0 +1,12 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
pragma solidity ^0.8.0;
|
||||
|
||||
contract ERC165MaliciousData {
|
||||
function supportsInterface(bytes4) public view returns (bool) {
|
||||
assembly {
|
||||
mstore(0, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
|
||||
return(0, 32)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@openzeppelin/contracts",
|
||||
"description": "Secure Smart Contract library for Solidity",
|
||||
"version": "4.7.0",
|
||||
"version": "4.7.1",
|
||||
"files": [
|
||||
"**/*.sol",
|
||||
"/build/contracts/*.json",
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/SignatureChecker.sol)
|
||||
// OpenZeppelin Contracts (last updated v4.7.1) (utils/cryptography/SignatureChecker.sol)
|
||||
|
||||
pragma solidity ^0.8.0;
|
||||
|
||||
@ -35,6 +35,8 @@ library SignatureChecker {
|
||||
(bool success, bytes memory result) = signer.staticcall(
|
||||
abi.encodeWithSelector(IERC1271.isValidSignature.selector, hash, signature)
|
||||
);
|
||||
return (success && result.length == 32 && abi.decode(result, (bytes4)) == IERC1271.isValidSignature.selector);
|
||||
return (success &&
|
||||
result.length == 32 &&
|
||||
abi.decode(result, (bytes32)) == bytes32(IERC1271.isValidSignature.selector));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165Checker.sol)
|
||||
// OpenZeppelin Contracts (last updated v4.7.1) (utils/introspection/ERC165Checker.sol)
|
||||
|
||||
pragma solidity ^0.8.0;
|
||||
|
||||
@ -108,6 +108,6 @@ library ERC165Checker {
|
||||
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));
|
||||
return success && abi.decode(result, (uint256)) > 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user