Skip to main content
Helpful?

EIP712_v4

Git Source - Generated with forge doc

Inherits: IEIP712_v4

Generic EIP712 implementation

Maintains cross-chain replay protection in the event of a fork

Should not be delegatecall'd because DOMAIN_SEPARATOR returns the cached hash and does not recompute with the delegatecallers address

Reference: https://github.com/Uniswap/permit2/blob/3f17e8db813189a03950dc7fc8382524a095c053/src/EIP712.sol

Reference: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/7bd2b2aaf68c21277097166a9a51eb72ae239b34/contracts/utils/cryptography/EIP712.sol

State Variables

_CACHED_DOMAIN_SEPARATOR

bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;

_CACHED_CHAIN_ID

uint256 private immutable _CACHED_CHAIN_ID;

_HASHED_NAME

bytes32 private immutable _HASHED_NAME;

_TYPE_HASH

bytes32 private constant _TYPE_HASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");

Functions

constructor

constructor(string memory name);

DOMAIN_SEPARATOR

Returns the domain separator for the current chain.

function DOMAIN_SEPARATOR() public view returns (bytes32);

Returns

NameTypeDescription
<none>bytes32bytes32 The domain separator

_buildDomainSeparator

Builds a domain separator using the current chainId and contract address.

function _buildDomainSeparator() private view returns (bytes32);

_hashTypedData

Creates an EIP-712 typed data hash

function _hashTypedData(bytes32 dataHash) internal view returns (bytes32 digest);
Helpful?