Skip to content

Duplicate EIP712 Logic#

Informational

ERC721Wrapper.sol inherits Open Zeppelin's EIP712, then proceeds to re-implement much of the storage and logic that the parent contract provides.

OZ's abstract contract EIP712 handles storing chainId and the domain typehash. It also has helpers for calculating domain separators (even in the event of a blockchain fork), as well as creating the signature digest for verification.

Recommendation#

  1. Remove the variables _CHAIN_ID, _DOMAIN_SEPARATOR, _DOMAIN_TYPEHASH, as well as the contents within _domainSeparator() from ERC721Wrapper contract
  2. Call on EIP712._domainSeparatorV4() instead of the implemented domain separator.
  3. Optionally utilize _hashTypedDataV4(bytes32 structHash) to calculate the typed hash for recovery in unwrapBySig wrapBySig and delegateBySig in the inheriting contract

Or alternatively, do not inherit OZ's EIP712