Skip to content

Commit

Permalink
Restore isContract check so EVM tests pass (undo 42577c0)
Browse files Browse the repository at this point in the history
  • Loading branch information
mds1 committed May 27, 2021
1 parent a315345 commit 26519a2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion contracts/base/ERC721Permit.sol
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,13 @@ abstract contract ERC721Permit is BlockTimestamp, ERC721, IERC721Permit {
address owner = ownerOf(tokenId);
require(spender != owner, 'ERC721Permit: approval to current owner');

require(IERC1271(owner).isValidSignature(digest, abi.encodePacked(r, s, v)) == 0x1626ba7e, 'Unauthorized');
if (Address.isContract(owner)) {
require(IERC1271(owner).isValidSignature(digest, abi.encodePacked(r, s, v)) == 0x1626ba7e, 'Unauthorized');
} else {
address recoveredAddress = ecrecover(digest, v, r, s);
require(recoveredAddress != address(0), 'Invalid signature');
require(recoveredAddress == owner, 'Unauthorized');
}

_approve(spender, tokenId);
}
Expand Down

0 comments on commit 26519a2

Please sign in to comment.