You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description: PermitERC721 imports Address.sol from openzeppelin-contracts library where only use isContract
Recommendation:
Implement directly isContract check in PermitERC721 and remove Address.sol dependency to reduce deployment code size and possibly improve gas efficiency.
diff --git a/src/base/PermitERC721.sol b/src/base/PermitERC721.sol
index a92acaf..cb20ce6 100644
--- a/src/base/PermitERC721.sol+++ b/src/base/PermitERC721.sol@@ -4,8 +4,6 @@ pragma solidity 0.8.14;
import { IERC1271 } from '@openzeppelin/contracts/interfaces/IERC1271.sol';
import { ERC721 } from '@openzeppelin/contracts/token/ERC721/ERC721.sol';
-import { Address } from '@openzeppelin/contracts/utils/Address.sol';-
/**
* @dev Interface for token permits for ERC-721
@@ -97,7 +95,7 @@ abstract contract PermitERC721 is ERC721, IPermit {
address owner = ownerOf(tokenId_);
require(spender_ != owner, "ERC721Permit: approval to current owner");
- if (Address.isContract(owner)) {+ if (owner.code.length > 0) {
// bytes4(keccak256("isValidSignature(bytes32,bytes)") == 0x1626ba7e
require(
IERC1271(owner).isValidSignature(digest, abi.encodePacked(r_, s_, v_)) == 0x1626ba7e,
Removing the import in favor of a locally implemented (even inlined) check does not affect contract size in testing (solc is generally smart enough to only import what's actually used, so I'm not surprised by this).
I'm closing this issue, and this finding will not appear in the final report. I added a note on eliminating the Address.sol import just for code readability purposes to #34.
Context: PermitERC721.sol#L7
Description:
PermitERC721
importsAddress.sol
fromopenzeppelin-contracts
library where only useisContract
Recommendation:
Implement directly
isContract
check inPermitERC721
and removeAddress.sol
dependency to reduce deployment code size and possibly improve gas efficiency.Ajna:
Removed usage of
Address.sol
in favor ofSignatureChecker
Prototech:
Code changed, adopting
SignatureChecker
that seems to importAddress.sol
even if not used.The text was updated successfully, but these errors were encountered: