ERC712Extended
Inherits: IERC712Extended
Author: M^0 Labs
An abstract implementation to satisfy EIP-712: https://eips.ethereum.org/EIPS/eip-712
State Variables
_EIP712_DOMAIN_HASH
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)")
_EIP712_VERSION_HASH
keccak256("1")
_INITIAL_CHAIN_ID
Initial Chain ID set at deployment.
_INITIAL_DOMAIN_SEPARATOR
Initial EIP-712 domain separator set at deployment.
_name
The name of the contract.
Functions
constructor
Constructs the EIP-712 domain separator.
Parameters
name_
string
The name of the contract.
eip712Domain
Returns the fields and values that describe the domain separator used by this contract for EIP-712.
DOMAIN_SEPARATOR
Returns the EIP712 domain separator used in the encoding of a signed digest.
_getDomainSeparator
Computes the EIP-712 domain separator.
Returns
<none>
bytes32
The EIP-712 domain separator.
_getDigest
Returns the digest to be signed, via EIP-712, given an internal digest (i.e. hash struct).
Parameters
internalDigest_
bytes32
The internal digest.
Returns
<none>
bytes32
The digest to be signed.
_revertIfExpired
Revert if the signature is expired.
Parameters
expiry_
uint256
Timestamp at which the signature expires or max uint256 for no expiry.
_revertIfInvalidSignature
Revert if the signature is invalid.
We first validate if the signature is a valid ECDSA signature and return early if it is the case. Then, we validate if it is a valid ERC-1271 signature, and return early if it is the case. If not, we revert with the error from the ECDSA signature validation.
Parameters
signer_
address
The signer of the signature.
digest_
bytes32
The digest that was signed.
signature_
bytes
The signature.
_getSignerAndRevertIfInvalidSignature
Returns the signer of a signed digest, via EIP-712, and reverts if the signature is invalid.
Parameters
digest_
bytes32
The digest that was signed.
v_
uint8
v of the signature.
r_
bytes32
r of the signature.
s_
bytes32
s of the signature.
Returns
signer_
address
The signer of the digest.
_revertIfInvalidSignature
Revert if the signature is invalid.
Parameters
signer_
address
The signer of the signature.
digest_
bytes32
The digest that was signed.
r_
bytes32
An ECDSA/secp256k1 signature parameter.
vs_
bytes32
An ECDSA/secp256k1 short signature parameter.
_revertIfInvalidSignature
Revert if the signature is invalid.
Parameters
signer_
address
The signer of the signature.
digest_
bytes32
The digest that was signed.
v_
uint8
v of the signature.
r_
bytes32
r of the signature.
s_
bytes32
s of the signature.
_revertIfError
Revert if error.
Parameters
error_
SignatureChecker.Error
The SignatureChecker Error enum.