Assessment reports>Nukem Loans>Discussion>EIP-712 implementation

EIP-712 implementation does not follow latest standard

The EIP-712 implementation in the contracts does not follow the latest standard, which was updated after EIP-5267. The EIP-5267 complements EIP-712 by standardizing how contracts should publish the fields and values that describe their domain. This enables applications to retrieve this description and generate appropriate domain separators in a general way and thus integrate EIP-712 signatures securely and scalably.

It does that through the addition of the eip712Domain function:

function eip712Domain()
    public
    view
    virtual
    returns (
        bytes1 fields,
        string memory name,
        string memory version,
        uint256 chainId,
        address verifyingContract,
        bytes32 salt,
        uint256[] memory extensions
    )
{
    return (
        hex"0f", // 01111
        _EIP712Name(),
        _EIP712Version(),
        block.chainid,
        address(this),
        bytes32(0),
        new uint256[](0)
    );
}

For more information, see the latest EIP-712 implementation example here.

Zellic © 2024Back to top ↑