EIP712

Git Source

SPDX-License-Identifier: MIT Copyright (c) 2020 CENTRE SECZ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

A library that provides EIP712 helper functions

State Variables

EIP712_DOMAIN_TYPEHASH

bytes32 public constant EIP712_DOMAIN_TYPEHASH = 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f;

Functions

makeDomainSeparator

Make EIP712 domain separator

function makeDomainSeparator(string memory name, string memory version) internal view returns (bytes32);

Parameters

NameTypeDescription
namestringContract name
versionstringContract version

Returns

NameTypeDescription
<none>bytes32Domain separator

recover

Recover signer's address from a EIP712 signature

function recover(bytes32 domainSeparator, uint8 v, bytes32 r, bytes32 s, bytes memory typeHashAndData)
    internal
    pure
    returns (address);

Parameters

NameTypeDescription
domainSeparatorbytes32Domain separator
vuint8v of the signature
rbytes32r of the signature
sbytes32s of the signature
typeHashAndDatabytesType hash concatenated with data

Returns

NameTypeDescription
<none>addressSigner's address