Skip to content

Commit

Permalink
remove address(this) check
Browse files Browse the repository at this point in the history
  • Loading branch information
saucepoint committed Aug 3, 2024
1 parent b59b1b5 commit 4cd765a
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .forge-snapshots/PositionManager_permit.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
79660
79624
Original file line number Diff line number Diff line change
@@ -1 +1 @@
62572
62536
2 changes: 1 addition & 1 deletion .forge-snapshots/PositionManager_permit_twice.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
45472
45436
4 changes: 1 addition & 3 deletions src/base/EIP712.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ contract EIP712 is IEIP712 {
// corresponds to, in order to invalidate the cached domain separator if the chain id changes.
bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;
uint256 private immutable _CACHED_CHAIN_ID;
address private immutable _CACHED_THIS;
bytes32 private immutable _HASHED_NAME;
bytes32 private immutable _HASHED_VERSION;

Expand All @@ -25,13 +24,12 @@ contract EIP712 is IEIP712 {

_CACHED_CHAIN_ID = block.chainid;
_CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator();
_CACHED_THIS = address(this);
}

/// @notice Returns the domain separator for the current chain.
/// @dev Uses cached version if chainid and address are unchanged from construction.
function DOMAIN_SEPARATOR() public view override returns (bytes32) {
return address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID
return block.chainid == _CACHED_CHAIN_ID
? _CACHED_DOMAIN_SEPARATOR
: _buildDomainSeparator();
}
Expand Down

0 comments on commit 4cd765a

Please sign in to comment.