Migrate all contract-related tooling and tests to accept a chain ID in domain separators.

This commit is contained in:
Lawrence Forman
2019-03-22 16:18:49 -04:00
committed by Amir Bandeali
parent 92fe720ac3
commit 2d28fde24d
39 changed files with 282 additions and 64 deletions

View File

@@ -11,6 +11,8 @@ chaiSetup.configure();
const expect = chai.expect;
describe('EIP712 Utils', () => {
const CHAIN_ID = 1337;
describe('createTypedData', () => {
it('adds in the EIP712DomainSeparator with default values', () => {
const primaryType = 'Test';
@@ -18,7 +20,7 @@ describe('EIP712 Utils', () => {
primaryType,
{ Test: [{ name: 'testValue', type: 'uint256' }] },
{ testValue: '1' },
{ verifyingContractAddress: constants.NULL_ADDRESS },
{ chainId: CHAIN_ID, verifyingContractAddress: constants.NULL_ADDRESS, },
);
expect(typedData.domain).to.not.be.undefined();
expect(typedData.types.EIP712Domain).to.not.be.undefined();
@@ -36,7 +38,12 @@ describe('EIP712 Utils', () => {
primaryType,
{ Test: [{ name: 'testValue', type: 'uint256' }] },
{ testValue: '1' },
{ name: domainName, version: domainVersion, verifyingContractAddress: constants.NULL_ADDRESS },
{
name: domainName,
version: domainVersion,
chainId: CHAIN_ID,
verifyingContractAddress: constants.NULL_ADDRESS,
},
);
expect(typedData.domain).to.not.be.undefined();
expect(typedData.types.EIP712Domain).to.not.be.undefined();
@@ -54,6 +61,7 @@ describe('EIP712 Utils', () => {
data: constants.NULL_BYTES,
signerAddress: constants.NULL_ADDRESS,
verifyingContractAddress: constants.NULL_ADDRESS,
chainId: CHAIN_ID,
});
expect(typedData.primaryType).to.eq(constants.EXCHANGE_ZEROEX_TRANSACTION_SCHEMA.name);
expect(typedData.types.EIP712Domain).to.not.be.undefined();