Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimise permit hashing #260

Merged
merged 2 commits into from
Aug 4, 2024
Merged
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
fuzz test
  • Loading branch information
hensha256 committed Aug 3, 2024
commit e153b0d11e85ebb4fd447d1630b02c4c78839f1c
6 changes: 6 additions & 0 deletions test/ERC721Permit.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ contract ERC721PermitTest is Test {
);
}

function test_fuzz_permitHash(address spender, uint256 tokenId, uint256 nonce, uint256 deadline) public view {
bytes32 expectedHash =
keccak256(abi.encode(ERC721PermitHashLibrary.PERMIT_TYPEHASH, spender, tokenId, nonce, deadline));
assertEq(expectedHash, ERC721PermitHashLibrary.hash(spender, tokenId, nonce, deadline));
}

function test_domainSeparator() public view {
assertEq(
IERC721Permit(address(erc721Permit)).DOMAIN_SEPARATOR(),
Expand Down
Loading