Change verifyingContractAddress -> verifyingContract everywhere
This commit is contained in:
parent
b359738037
commit
ae75aed55e
@ -112,7 +112,7 @@ describe('Coordinator tests', () => {
|
|||||||
makerFeeAssetData: assetDataUtils.encodeERC20AssetData(makerFeeToken.address),
|
makerFeeAssetData: assetDataUtils.encodeERC20AssetData(makerFeeToken.address),
|
||||||
takerFeeAssetData: assetDataUtils.encodeERC20AssetData(makerFeeToken.address),
|
takerFeeAssetData: assetDataUtils.encodeERC20AssetData(makerFeeToken.address),
|
||||||
domain: {
|
domain: {
|
||||||
verifyingContractAddress: exchange.address,
|
verifyingContract: exchange.address,
|
||||||
chainId,
|
chainId,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -47,7 +47,7 @@ describe('Libs tests', () => {
|
|||||||
signerAddress: constants.NULL_ADDRESS,
|
signerAddress: constants.NULL_ADDRESS,
|
||||||
data: '0x1234',
|
data: '0x1234',
|
||||||
domain: {
|
domain: {
|
||||||
verifyingContractAddress: exchangeAddress,
|
verifyingContract: exchangeAddress,
|
||||||
chainId,
|
chainId,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -66,7 +66,7 @@ describe('Libs tests', () => {
|
|||||||
data: '0x1234',
|
data: '0x1234',
|
||||||
signature: '0x5678',
|
signature: '0x5678',
|
||||||
domain: {
|
domain: {
|
||||||
verifyingContractAddress: exchangeAddress,
|
verifyingContract: exchangeAddress,
|
||||||
chainId,
|
chainId,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -55,7 +55,7 @@ describe('Mixins tests', () => {
|
|||||||
const accounts = await web3Wrapper.getAvailableAddressesAsync();
|
const accounts = await web3Wrapper.getAvailableAddressesAsync();
|
||||||
[transactionSignerAddress, approvalSignerAddress1, approvalSignerAddress2] = accounts.slice(0, 3);
|
[transactionSignerAddress, approvalSignerAddress1, approvalSignerAddress2] = accounts.slice(0, 3);
|
||||||
exchangeDomain = {
|
exchangeDomain = {
|
||||||
verifyingContractAddress: constants.NULL_ADDRESS,
|
verifyingContract: constants.NULL_ADDRESS,
|
||||||
chainId,
|
chainId,
|
||||||
};
|
};
|
||||||
defaultOrder = {
|
defaultOrder = {
|
||||||
|
@ -9,9 +9,9 @@ export class ApprovalFactory {
|
|||||||
private readonly _privateKey: Buffer;
|
private readonly _privateKey: Buffer;
|
||||||
private readonly _verifyingContractAddress: string;
|
private readonly _verifyingContractAddress: string;
|
||||||
|
|
||||||
constructor(privateKey: Buffer, verifyingContractAddress: string) {
|
constructor(privateKey: Buffer, verifyingContract: string) {
|
||||||
this._privateKey = privateKey;
|
this._privateKey = privateKey;
|
||||||
this._verifyingContractAddress = verifyingContractAddress;
|
this._verifyingContractAddress = verifyingContract;
|
||||||
}
|
}
|
||||||
|
|
||||||
public newSignedApproval(
|
public newSignedApproval(
|
||||||
|
@ -6,13 +6,13 @@ import * as _ from 'lodash';
|
|||||||
export const hashUtils = {
|
export const hashUtils = {
|
||||||
getApprovalHashBuffer(
|
getApprovalHashBuffer(
|
||||||
transaction: SignedZeroExTransaction,
|
transaction: SignedZeroExTransaction,
|
||||||
verifyingContractAddress: string,
|
verifyingContract: string,
|
||||||
txOrigin: string,
|
txOrigin: string,
|
||||||
approvalExpirationTimeSeconds: BigNumber,
|
approvalExpirationTimeSeconds: BigNumber,
|
||||||
): Buffer {
|
): Buffer {
|
||||||
const typedData = eip712Utils.createCoordinatorApprovalTypedData(
|
const typedData = eip712Utils.createCoordinatorApprovalTypedData(
|
||||||
transaction,
|
transaction,
|
||||||
verifyingContractAddress,
|
verifyingContract,
|
||||||
txOrigin,
|
txOrigin,
|
||||||
approvalExpirationTimeSeconds,
|
approvalExpirationTimeSeconds,
|
||||||
);
|
);
|
||||||
@ -21,12 +21,12 @@ export const hashUtils = {
|
|||||||
},
|
},
|
||||||
getApprovalHashHex(
|
getApprovalHashHex(
|
||||||
transaction: SignedZeroExTransaction,
|
transaction: SignedZeroExTransaction,
|
||||||
verifyingContractAddress: string,
|
verifyingContract: string,
|
||||||
txOrigin: string,
|
txOrigin: string,
|
||||||
approvalExpirationTimeSeconds: BigNumber,
|
approvalExpirationTimeSeconds: BigNumber,
|
||||||
): string {
|
): string {
|
||||||
const hashHex = `0x${hashUtils
|
const hashHex = `0x${hashUtils
|
||||||
.getApprovalHashBuffer(transaction, verifyingContractAddress, txOrigin, approvalExpirationTimeSeconds)
|
.getApprovalHashBuffer(transaction, verifyingContract, txOrigin, approvalExpirationTimeSeconds)
|
||||||
.toString('hex')}`;
|
.toString('hex')}`;
|
||||||
return hashHex;
|
return hashHex;
|
||||||
},
|
},
|
||||||
|
@ -121,7 +121,7 @@ describe('OrderValidationUtils/OrderTransferSimulatorUtils', () => {
|
|||||||
makerFeeAssetData: feeAssetData,
|
makerFeeAssetData: feeAssetData,
|
||||||
takerFeeAssetData: feeAssetData,
|
takerFeeAssetData: feeAssetData,
|
||||||
domain: {
|
domain: {
|
||||||
verifyingContractAddress: exchange.address,
|
verifyingContract: exchange.address,
|
||||||
chainId,
|
chainId,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -121,7 +121,7 @@ blockchainTests(ContractName.Forwarder, env => {
|
|||||||
makerFee: Web3Wrapper.toBaseUnitAmount(0, DECIMALS_DEFAULT),
|
makerFee: Web3Wrapper.toBaseUnitAmount(0, DECIMALS_DEFAULT),
|
||||||
takerFee: Web3Wrapper.toBaseUnitAmount(0, DECIMALS_DEFAULT),
|
takerFee: Web3Wrapper.toBaseUnitAmount(0, DECIMALS_DEFAULT),
|
||||||
domain: {
|
domain: {
|
||||||
verifyingContractAddress: exchangeInstance.address,
|
verifyingContract: exchangeInstance.address,
|
||||||
chainId,
|
chainId,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -17,7 +17,7 @@ blockchainTests('LibEIP712ExchangeDomain', env => {
|
|||||||
constants.NULL_ADDRESS,
|
constants.NULL_ADDRESS,
|
||||||
);
|
);
|
||||||
const domain = {
|
const domain = {
|
||||||
verifyingContractAddress: libEIP712ExchangeDomainContract.address,
|
verifyingContract: libEIP712ExchangeDomainContract.address,
|
||||||
chainId,
|
chainId,
|
||||||
name: constants.EIP712_DOMAIN_NAME,
|
name: constants.EIP712_DOMAIN_NAME,
|
||||||
version: constants.EIP712_DOMAIN_VERSION,
|
version: constants.EIP712_DOMAIN_VERSION,
|
||||||
@ -28,17 +28,17 @@ blockchainTests('LibEIP712ExchangeDomain', env => {
|
|||||||
});
|
});
|
||||||
it('should calculate the correct domain hash when verifyingContractAddressIfExists is set to a non-null address', async () => {
|
it('should calculate the correct domain hash when verifyingContractAddressIfExists is set to a non-null address', async () => {
|
||||||
const chainId = 1;
|
const chainId = 1;
|
||||||
const verifyingContractAddress = randomAddress();
|
const verifyingContract = randomAddress();
|
||||||
const libEIP712ExchangeDomainContract = await TestLibEIP712ExchangeDomainContract.deployFrom0xArtifactAsync(
|
const libEIP712ExchangeDomainContract = await TestLibEIP712ExchangeDomainContract.deployFrom0xArtifactAsync(
|
||||||
artifacts.TestLibEIP712ExchangeDomain,
|
artifacts.TestLibEIP712ExchangeDomain,
|
||||||
env.provider,
|
env.provider,
|
||||||
env.txDefaults,
|
env.txDefaults,
|
||||||
{},
|
{},
|
||||||
new BigNumber(chainId),
|
new BigNumber(chainId),
|
||||||
verifyingContractAddress,
|
verifyingContract,
|
||||||
);
|
);
|
||||||
const domain = {
|
const domain = {
|
||||||
verifyingContractAddress,
|
verifyingContract,
|
||||||
chainId,
|
chainId,
|
||||||
name: constants.EIP712_DOMAIN_NAME,
|
name: constants.EIP712_DOMAIN_NAME,
|
||||||
version: constants.EIP712_DOMAIN_VERSION,
|
version: constants.EIP712_DOMAIN_VERSION,
|
||||||
|
@ -537,7 +537,7 @@ blockchainTests('LibFillResults', env => {
|
|||||||
expirationTimeSeconds: randomUint256(),
|
expirationTimeSeconds: randomUint256(),
|
||||||
salt: randomUint256(),
|
salt: randomUint256(),
|
||||||
domain: {
|
domain: {
|
||||||
verifyingContractAddress: constants.NULL_ADDRESS,
|
verifyingContract: constants.NULL_ADDRESS,
|
||||||
chainId: 1337, // The chain id for the isolated exchange
|
chainId: 1337, // The chain id for the isolated exchange
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -547,7 +547,7 @@ blockchainTests('LibFillResults', env => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
ORDER_DEFAULTS.domain.verifyingContractAddress = libsContract.address;
|
ORDER_DEFAULTS.domain.verifyingContract = libsContract.address;
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should correctly calculate the results when only the right order is fully filled', async () => {
|
it('should correctly calculate the results when only the right order is fully filled', async () => {
|
||||||
@ -1210,7 +1210,7 @@ blockchainTests('LibFillResults', env => {
|
|||||||
expirationTimeSeconds: randomUint256(),
|
expirationTimeSeconds: randomUint256(),
|
||||||
salt: randomUint256(),
|
salt: randomUint256(),
|
||||||
domain: {
|
domain: {
|
||||||
verifyingContractAddress: constants.NULL_ADDRESS,
|
verifyingContract: constants.NULL_ADDRESS,
|
||||||
chainId: 1337, // The chain id for the isolated exchange
|
chainId: 1337, // The chain id for the isolated exchange
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -1220,7 +1220,7 @@ blockchainTests('LibFillResults', env => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
ORDER_DEFAULTS.domain.verifyingContractAddress = libsContract.address;
|
ORDER_DEFAULTS.domain.verifyingContract = libsContract.address;
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should transfer correct amounts when right order is fully filled', async () => {
|
it('should transfer correct amounts when right order is fully filled', async () => {
|
||||||
|
@ -17,7 +17,7 @@ blockchainTests('LibOrder', env => {
|
|||||||
|
|
||||||
const EMPTY_ORDER: Order = {
|
const EMPTY_ORDER: Order = {
|
||||||
domain: {
|
domain: {
|
||||||
verifyingContractAddress: constants.NULL_ADDRESS,
|
verifyingContract: constants.NULL_ADDRESS,
|
||||||
chainId: 0,
|
chainId: 0,
|
||||||
},
|
},
|
||||||
senderAddress: constants.NULL_ADDRESS,
|
senderAddress: constants.NULL_ADDRESS,
|
||||||
@ -67,7 +67,7 @@ blockchainTests('LibOrder', env => {
|
|||||||
...EMPTY_ORDER,
|
...EMPTY_ORDER,
|
||||||
domain: {
|
domain: {
|
||||||
...EMPTY_ORDER.domain,
|
...EMPTY_ORDER.domain,
|
||||||
verifyingContractAddress: libOrderContract.address,
|
verifyingContract: libOrderContract.address,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -75,7 +75,7 @@ blockchainTests('LibOrder', env => {
|
|||||||
it('should correctly hash a non-empty order', async () => {
|
it('should correctly hash a non-empty order', async () => {
|
||||||
await testGetTypedDataHashAsync({
|
await testGetTypedDataHashAsync({
|
||||||
domain: {
|
domain: {
|
||||||
verifyingContractAddress: libOrderContract.address,
|
verifyingContract: libOrderContract.address,
|
||||||
chainId: 1337,
|
chainId: 1337,
|
||||||
},
|
},
|
||||||
senderAddress: randomAddress(),
|
senderAddress: randomAddress(),
|
||||||
@ -136,7 +136,7 @@ blockchainTests('LibOrder', env => {
|
|||||||
await testGetStructHashAsync({
|
await testGetStructHashAsync({
|
||||||
// The domain is not used in this test, so it's okay if it is left empty.
|
// The domain is not used in this test, so it's okay if it is left empty.
|
||||||
domain: {
|
domain: {
|
||||||
verifyingContractAddress: constants.NULL_ADDRESS,
|
verifyingContract: constants.NULL_ADDRESS,
|
||||||
chainId: 0,
|
chainId: 0,
|
||||||
},
|
},
|
||||||
senderAddress: randomAddress(),
|
senderAddress: randomAddress(),
|
||||||
|
@ -22,7 +22,7 @@ blockchainTests('LibZeroExTransaction', env => {
|
|||||||
signerAddress: constants.NULL_ADDRESS,
|
signerAddress: constants.NULL_ADDRESS,
|
||||||
data: constants.NULL_BYTES,
|
data: constants.NULL_BYTES,
|
||||||
domain: {
|
domain: {
|
||||||
verifyingContractAddress: constants.NULL_ADDRESS,
|
verifyingContract: constants.NULL_ADDRESS,
|
||||||
chainId: 0,
|
chainId: 0,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -58,7 +58,7 @@ blockchainTests('LibZeroExTransaction', env => {
|
|||||||
...EMPTY_TRANSACTION,
|
...EMPTY_TRANSACTION,
|
||||||
domain: {
|
domain: {
|
||||||
...EMPTY_TRANSACTION.domain,
|
...EMPTY_TRANSACTION.domain,
|
||||||
verifyingContractAddress: libZeroExTransactionContract.address,
|
verifyingContract: libZeroExTransactionContract.address,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -72,7 +72,7 @@ blockchainTests('LibZeroExTransaction', env => {
|
|||||||
data: randomAssetData(),
|
data: randomAssetData(),
|
||||||
domain: {
|
domain: {
|
||||||
...EMPTY_TRANSACTION.domain,
|
...EMPTY_TRANSACTION.domain,
|
||||||
verifyingContractAddress: libZeroExTransactionContract.address,
|
verifyingContract: libZeroExTransactionContract.address,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -128,7 +128,7 @@ blockchainTests('LibZeroExTransaction', env => {
|
|||||||
data: randomAssetData(),
|
data: randomAssetData(),
|
||||||
// The domain is not used in this test, so it's okay if it is left empty.
|
// The domain is not used in this test, so it's okay if it is left empty.
|
||||||
domain: {
|
domain: {
|
||||||
verifyingContractAddress: constants.NULL_ADDRESS,
|
verifyingContract: constants.NULL_ADDRESS,
|
||||||
chainId: 0,
|
chainId: 0,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -218,7 +218,7 @@ blockchainTests.resets('Exchange core', () => {
|
|||||||
makerFeeAssetData: assetDataUtils.encodeERC20AssetData(defaultFeeAssetAddress),
|
makerFeeAssetData: assetDataUtils.encodeERC20AssetData(defaultFeeAssetAddress),
|
||||||
takerFeeAssetData: assetDataUtils.encodeERC20AssetData(defaultFeeAssetAddress),
|
takerFeeAssetData: assetDataUtils.encodeERC20AssetData(defaultFeeAssetAddress),
|
||||||
domain: {
|
domain: {
|
||||||
verifyingContractAddress: exchange.address,
|
verifyingContract: exchange.address,
|
||||||
chainId,
|
chainId,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -57,7 +57,7 @@ blockchainTests('Exchange core internal functions', env => {
|
|||||||
feeRecipientAddress: randomAddress(),
|
feeRecipientAddress: randomAddress(),
|
||||||
expirationTimeSeconds: new BigNumber(_.random(0, 1e8)),
|
expirationTimeSeconds: new BigNumber(_.random(0, 1e8)),
|
||||||
domain: {
|
domain: {
|
||||||
verifyingContractAddress: constants.NULL_ADDRESS,
|
verifyingContract: constants.NULL_ADDRESS,
|
||||||
chainId: 1337, // The chain id for the isolated exchange
|
chainId: 1337, // The chain id for the isolated exchange
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -67,7 +67,7 @@ blockchainTests('Exchange core internal functions', env => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
ORDER_DEFAULTS.domain.verifyingContractAddress = testExchange.address;
|
ORDER_DEFAULTS.domain.verifyingContract = testExchange.address;
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should revert if the maker asset multiplication should overflow', async () => {
|
it('should revert if the maker asset multiplication should overflow', async () => {
|
||||||
|
@ -199,7 +199,7 @@ describe('matchOrders', () => {
|
|||||||
defaultERC721AssetAddress = erc721Token.address;
|
defaultERC721AssetAddress = erc721Token.address;
|
||||||
defaultERC1155AssetAddress = erc1155Token.address;
|
defaultERC1155AssetAddress = erc1155Token.address;
|
||||||
const domain = {
|
const domain = {
|
||||||
verifyingContractAddress: exchange.address,
|
verifyingContract: exchange.address,
|
||||||
chainId,
|
chainId,
|
||||||
};
|
};
|
||||||
// Create default order parameters
|
// Create default order parameters
|
||||||
|
@ -436,7 +436,7 @@ blockchainTests.resets('MixinSignatureValidator', env => {
|
|||||||
makerFee: constants.ZERO_AMOUNT,
|
makerFee: constants.ZERO_AMOUNT,
|
||||||
takerFee: constants.ZERO_AMOUNT,
|
takerFee: constants.ZERO_AMOUNT,
|
||||||
domain: {
|
domain: {
|
||||||
verifyingContractAddress: signatureValidator.address,
|
verifyingContract: signatureValidator.address,
|
||||||
chainId,
|
chainId,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -108,7 +108,7 @@ blockchainTests.resets('Exchange transactions', env => {
|
|||||||
defaultTakerFeeTokenAddress = takerFeeToken.address;
|
defaultTakerFeeTokenAddress = takerFeeToken.address;
|
||||||
|
|
||||||
domain = {
|
domain = {
|
||||||
verifyingContractAddress: exchangeInstance.address,
|
verifyingContract: exchangeInstance.address,
|
||||||
chainId,
|
chainId,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ blockchainTests.resets('Transaction Unit Tests', ({ provider, web3Wrapper, txDef
|
|||||||
signerAddress: constants.NULL_ADDRESS,
|
signerAddress: constants.NULL_ADDRESS,
|
||||||
data: constants.NULL_BYTES,
|
data: constants.NULL_BYTES,
|
||||||
domain: {
|
domain: {
|
||||||
verifyingContractAddress: constants.NULL_ADDRESS,
|
verifyingContract: constants.NULL_ADDRESS,
|
||||||
chainId: 0,
|
chainId: 0,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -45,7 +45,7 @@ blockchainTests.resets('Transaction Unit Tests', ({ provider, web3Wrapper, txDef
|
|||||||
|
|
||||||
// Set the default domain.
|
// Set the default domain.
|
||||||
domain = {
|
domain = {
|
||||||
verifyingContractAddress: transactionsContract.address,
|
verifyingContract: transactionsContract.address,
|
||||||
chainId: 1337,
|
chainId: 1337,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
@ -102,7 +102,7 @@ export class IsolatedExchangeWrapper {
|
|||||||
|
|
||||||
public getOrderHash(order: Order): string {
|
public getOrderHash(order: Order): string {
|
||||||
const domain = {
|
const domain = {
|
||||||
verifyingContractAddress: this.instance.address,
|
verifyingContract: this.instance.address,
|
||||||
chainId: IsolatedExchangeWrapper.CHAIN_ID,
|
chainId: IsolatedExchangeWrapper.CHAIN_ID,
|
||||||
};
|
};
|
||||||
return orderHashUtils.getOrderHashHex({ ...order, domain });
|
return orderHashUtils.getOrderHashHex({ ...order, domain });
|
||||||
|
@ -431,7 +431,7 @@ export class OrderFactoryFromScenario {
|
|||||||
feeRecipientAddress,
|
feeRecipientAddress,
|
||||||
expirationTimeSeconds,
|
expirationTimeSeconds,
|
||||||
domain: {
|
domain: {
|
||||||
verifyingContractAddress: this._exchangeAddress,
|
verifyingContract: this._exchangeAddress,
|
||||||
chainId: this._chainId,
|
chainId: this._chainId,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -98,7 +98,7 @@ blockchainTests.resets('Exchange wrappers', env => {
|
|||||||
makerFeeAssetData: assetDataUtils.encodeERC20AssetData(defaultFeeAssetAddress),
|
makerFeeAssetData: assetDataUtils.encodeERC20AssetData(defaultFeeAssetAddress),
|
||||||
takerFeeAssetData: assetDataUtils.encodeERC20AssetData(defaultFeeAssetAddress),
|
takerFeeAssetData: assetDataUtils.encodeERC20AssetData(defaultFeeAssetAddress),
|
||||||
domain: {
|
domain: {
|
||||||
verifyingContractAddress: exchange.address,
|
verifyingContract: exchange.address,
|
||||||
chainId,
|
chainId,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -91,7 +91,7 @@ blockchainTests('Exchange wrapper functions unit tests.', env => {
|
|||||||
return orderHashUtils.getOrderHashHex({
|
return orderHashUtils.getOrderHashHex({
|
||||||
...order,
|
...order,
|
||||||
domain: {
|
domain: {
|
||||||
verifyingContractAddress: testContract.address,
|
verifyingContract: testContract.address,
|
||||||
chainId: CHAIN_ID,
|
chainId: CHAIN_ID,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -178,7 +178,7 @@ describe(ContractName.BalanceThresholdFilter, () => {
|
|||||||
takerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(150), DECIMALS_DEFAULT),
|
takerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(150), DECIMALS_DEFAULT),
|
||||||
senderAddress: erc721BalanceThresholdFilterInstance.address,
|
senderAddress: erc721BalanceThresholdFilterInstance.address,
|
||||||
domain: {
|
domain: {
|
||||||
verifyingContractAddress: exchangeInstance.address,
|
verifyingContract: exchangeInstance.address,
|
||||||
chainId,
|
chainId,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -164,7 +164,7 @@ describe(ContractName.DutchAuction, () => {
|
|||||||
makerFee: constants.ZERO_AMOUNT,
|
makerFee: constants.ZERO_AMOUNT,
|
||||||
takerFee: constants.ZERO_AMOUNT,
|
takerFee: constants.ZERO_AMOUNT,
|
||||||
domain: {
|
domain: {
|
||||||
verifyingContractAddress: exchangeInstance.address,
|
verifyingContract: exchangeInstance.address,
|
||||||
chainId,
|
chainId,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -167,7 +167,7 @@ describe('OrderMatcher', () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const domain = {
|
const domain = {
|
||||||
verifyingContractAddress: exchange.address,
|
verifyingContract: exchange.address,
|
||||||
chainId,
|
chainId,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ export class TransactionFactory {
|
|||||||
expirationTimeSeconds: new BigNumber(currentBlockTimestamp).plus(tenMinutesInSeconds),
|
expirationTimeSeconds: new BigNumber(currentBlockTimestamp).plus(tenMinutesInSeconds),
|
||||||
gasPrice: new BigNumber(constants.DEFAULT_GAS_PRICE),
|
gasPrice: new BigNumber(constants.DEFAULT_GAS_PRICE),
|
||||||
domain: {
|
domain: {
|
||||||
verifyingContractAddress: this._exchangeAddress,
|
verifyingContract: this._exchangeAddress,
|
||||||
chainId: this._chainId,
|
chainId: this._chainId,
|
||||||
},
|
},
|
||||||
...customTransactionParams,
|
...customTransactionParams,
|
||||||
|
@ -30,25 +30,25 @@ describe('LibEIP712', () => {
|
|||||||
* @param name The name of the domain.
|
* @param name The name of the domain.
|
||||||
* @param version The version of the domain.
|
* @param version The version of the domain.
|
||||||
* @param chainId The chain id of the domain.
|
* @param chainId The chain id of the domain.
|
||||||
* @param verifyingContractAddress The verifying contract address of the domain.
|
* @param verifyingContract The verifying contract address of the domain.
|
||||||
*/
|
*/
|
||||||
async function testHashEIP712DomainAsync(
|
async function testHashEIP712DomainAsync(
|
||||||
name: string,
|
name: string,
|
||||||
version: string,
|
version: string,
|
||||||
chainId: number,
|
chainId: number,
|
||||||
verifyingContractAddress: string,
|
verifyingContract: string,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const expectedHash = signTypedDataUtils.generateDomainHash({
|
const expectedHash = signTypedDataUtils.generateDomainHash({
|
||||||
name,
|
name,
|
||||||
version,
|
version,
|
||||||
chainId,
|
chainId,
|
||||||
verifyingContractAddress,
|
verifyingContract,
|
||||||
});
|
});
|
||||||
const actualHash = await lib.externalHashEIP712DomainSeperator.callAsync(
|
const actualHash = await lib.externalHashEIP712DomainSeperator.callAsync(
|
||||||
name,
|
name,
|
||||||
version,
|
version,
|
||||||
new BigNumber(chainId),
|
new BigNumber(chainId),
|
||||||
verifyingContractAddress,
|
verifyingContract,
|
||||||
);
|
);
|
||||||
expect(actualHash).to.be.eq(hexConcat(expectedHash));
|
expect(actualHash).to.be.eq(hexConcat(expectedHash));
|
||||||
}
|
}
|
||||||
|
@ -686,7 +686,7 @@ export class CoordinatorWrapper {
|
|||||||
signerAddress,
|
signerAddress,
|
||||||
data,
|
data,
|
||||||
domain: {
|
domain: {
|
||||||
verifyingContractAddress: this.exchangeAddress,
|
verifyingContract: this.exchangeAddress,
|
||||||
chainId: await this._web3Wrapper.getChainIdAsync(),
|
chainId: await this._web3Wrapper.getChainIdAsync(),
|
||||||
},
|
},
|
||||||
// HACK (xianny): arbitrary numbers for now
|
// HACK (xianny): arbitrary numbers for now
|
||||||
|
@ -40,7 +40,7 @@ describe('ABI Decoding Calldata', () => {
|
|||||||
const exchangeAddress = addressUtils.generatePseudoRandomAddress();
|
const exchangeAddress = addressUtils.generatePseudoRandomAddress();
|
||||||
const feeRecipientAddress = addressUtils.generatePseudoRandomAddress();
|
const feeRecipientAddress = addressUtils.generatePseudoRandomAddress();
|
||||||
const domain = {
|
const domain = {
|
||||||
verifyingContractAddress: exchangeAddress,
|
verifyingContract: exchangeAddress,
|
||||||
chainId,
|
chainId,
|
||||||
};
|
};
|
||||||
// Create orders to match.
|
// Create orders to match.
|
||||||
|
@ -124,7 +124,7 @@ export class FillScenarios {
|
|||||||
fillableAmount,
|
fillableAmount,
|
||||||
);
|
);
|
||||||
const exchangeInstance = new ExchangeContract(
|
const exchangeInstance = new ExchangeContract(
|
||||||
signedOrder.domain.verifyingContractAddress,
|
signedOrder.domain.verifyingContract,
|
||||||
this._web3Wrapper.getProvider(),
|
this._web3Wrapper.getProvider(),
|
||||||
this._web3Wrapper.getContractDefaults(),
|
this._web3Wrapper.getContractDefaults(),
|
||||||
);
|
);
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
"chainId",
|
"chainId",
|
||||||
"verifyingContractAddress"
|
"verifyingContract"
|
||||||
],
|
],
|
||||||
"type": "object"
|
"type": "object"
|
||||||
}
|
}
|
||||||
|
@ -220,7 +220,7 @@ describe('Schema', () => {
|
|||||||
feeRecipientAddress: NULL_ADDRESS,
|
feeRecipientAddress: NULL_ADDRESS,
|
||||||
expirationTimeSeconds: '42',
|
expirationTimeSeconds: '42',
|
||||||
domain: {
|
domain: {
|
||||||
verifyingContractAddress: NULL_ADDRESS,
|
verifyingContract: NULL_ADDRESS,
|
||||||
chainId: CHAIN_ID,
|
chainId: CHAIN_ID,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -107,7 +107,7 @@ export const constants = {
|
|||||||
{ name: 'name', type: 'string' },
|
{ name: 'name', type: 'string' },
|
||||||
{ name: 'version', type: 'string' },
|
{ name: 'version', type: 'string' },
|
||||||
{ name: 'chainId', type: 'uint256' },
|
{ name: 'chainId', type: 'uint256' },
|
||||||
{ name: 'verifyingContractAddress', type: 'address' },
|
{ name: 'verifyingContract', type: 'address' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
EXCHANGE_ORDER_SCHEMA: {
|
EXCHANGE_ORDER_SCHEMA: {
|
||||||
|
@ -30,7 +30,7 @@ export const eip712Utils = {
|
|||||||
message: EIP712Object,
|
message: EIP712Object,
|
||||||
domain: EIP712DomainWithDefaultSchema,
|
domain: EIP712DomainWithDefaultSchema,
|
||||||
): EIP712TypedData => {
|
): EIP712TypedData => {
|
||||||
assert.isETHAddressHex('verifyingContractAddress', domain.verifyingContractAddress);
|
assert.isETHAddressHex('verifyingContract', domain.verifyingContract);
|
||||||
assert.isString('primaryType', primaryType);
|
assert.isString('primaryType', primaryType);
|
||||||
const typedData = {
|
const typedData = {
|
||||||
types: {
|
types: {
|
||||||
@ -41,7 +41,7 @@ export const eip712Utils = {
|
|||||||
name: domain.name === undefined ? constants.EXCHANGE_DOMAIN_NAME : domain.name,
|
name: domain.name === undefined ? constants.EXCHANGE_DOMAIN_NAME : domain.name,
|
||||||
version: domain.version === undefined ? constants.EXCHANGE_DOMAIN_VERSION : domain.version,
|
version: domain.version === undefined ? constants.EXCHANGE_DOMAIN_VERSION : domain.version,
|
||||||
chainId: domain.chainId,
|
chainId: domain.chainId,
|
||||||
verifyingContractAddress: domain.verifyingContractAddress,
|
verifyingContract: domain.verifyingContract,
|
||||||
},
|
},
|
||||||
message,
|
message,
|
||||||
primaryType,
|
primaryType,
|
||||||
@ -75,7 +75,7 @@ export const eip712Utils = {
|
|||||||
*/
|
*/
|
||||||
createZeroExTransactionTypedData: (zeroExTransaction: ZeroExTransaction): EIP712TypedData => {
|
createZeroExTransactionTypedData: (zeroExTransaction: ZeroExTransaction): EIP712TypedData => {
|
||||||
assert.isNumber('domain.chainId', zeroExTransaction.domain.chainId);
|
assert.isNumber('domain.chainId', zeroExTransaction.domain.chainId);
|
||||||
assert.isETHAddressHex('domain.verifyingContractAddress', zeroExTransaction.domain.verifyingContractAddress);
|
assert.isETHAddressHex('domain.verifyingContract', zeroExTransaction.domain.verifyingContract);
|
||||||
assert.doesConformToSchema('zeroExTransaction', zeroExTransaction, schemas.zeroExTransactionSchema);
|
assert.doesConformToSchema('zeroExTransaction', zeroExTransaction, schemas.zeroExTransactionSchema);
|
||||||
const normalizedTransaction = _.mapValues(zeroExTransaction, value => {
|
const normalizedTransaction = _.mapValues(zeroExTransaction, value => {
|
||||||
return !_.isString(value) ? value.toString() : value;
|
return !_.isString(value) ? value.toString() : value;
|
||||||
@ -91,14 +91,14 @@ export const eip712Utils = {
|
|||||||
/**
|
/**
|
||||||
* Creates an Coordiantor typedData EIP712TypedData object for use with the Coordinator extension contract
|
* Creates an Coordiantor typedData EIP712TypedData object for use with the Coordinator extension contract
|
||||||
* @param transaction A 0x transaction
|
* @param transaction A 0x transaction
|
||||||
* @param verifyingContractAddress The coordinator extension contract address that will be verifying the typedData
|
* @param verifyingContract The coordinator extension contract address that will be verifying the typedData
|
||||||
* @param txOrigin The desired `tx.origin` that should be able to submit an Ethereum txn involving this 0x transaction
|
* @param txOrigin The desired `tx.origin` that should be able to submit an Ethereum txn involving this 0x transaction
|
||||||
* @param approvalExpirationTimeSeconds The approvals expiration time
|
* @param approvalExpirationTimeSeconds The approvals expiration time
|
||||||
* @return A typed data object
|
* @return A typed data object
|
||||||
*/
|
*/
|
||||||
createCoordinatorApprovalTypedData: (
|
createCoordinatorApprovalTypedData: (
|
||||||
transaction: SignedZeroExTransaction,
|
transaction: SignedZeroExTransaction,
|
||||||
verifyingContractAddress: string,
|
verifyingContract: string,
|
||||||
txOrigin: string,
|
txOrigin: string,
|
||||||
approvalExpirationTimeSeconds: BigNumber,
|
approvalExpirationTimeSeconds: BigNumber,
|
||||||
): EIP712TypedData => {
|
): EIP712TypedData => {
|
||||||
@ -106,7 +106,7 @@ export const eip712Utils = {
|
|||||||
...transaction.domain,
|
...transaction.domain,
|
||||||
name: constants.COORDINATOR_DOMAIN_NAME,
|
name: constants.COORDINATOR_DOMAIN_NAME,
|
||||||
version: constants.COORDINATOR_DOMAIN_VERSION,
|
version: constants.COORDINATOR_DOMAIN_VERSION,
|
||||||
verifyingContractAddress,
|
verifyingContract,
|
||||||
};
|
};
|
||||||
const transactionHash = transactionHashUtils.getTransactionHashHex(transaction);
|
const transactionHash = transactionHashUtils.getTransactionHashHex(transaction);
|
||||||
const approval = {
|
const approval = {
|
||||||
|
@ -96,12 +96,12 @@ export class SignatureWalletError extends RevertError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class EIP1271SignatureError extends RevertError {
|
export class EIP1271SignatureError extends RevertError {
|
||||||
constructor(verifyingContractAddress?: string, data?: string, signature?: string, errorData?: string) {
|
constructor(verifyingContract?: string, data?: string, signature?: string, errorData?: string) {
|
||||||
super(
|
super(
|
||||||
'EIP1271SignatureError',
|
'EIP1271SignatureError',
|
||||||
'EIP1271SignatureError(address verifyingContractAddress, bytes data, bytes signature, bytes errorData)',
|
'EIP1271SignatureError(address verifyingContract, bytes data, bytes signature, bytes errorData)',
|
||||||
{
|
{
|
||||||
verifyingContractAddress,
|
verifyingContract,
|
||||||
data,
|
data,
|
||||||
signature,
|
signature,
|
||||||
errorData,
|
errorData,
|
||||||
|
@ -53,7 +53,7 @@ export const orderFactory = {
|
|||||||
expirationTimeSeconds:
|
expirationTimeSeconds:
|
||||||
createOrderOpts.expirationTimeSeconds || defaultCreateOrderOpts.expirationTimeSeconds,
|
createOrderOpts.expirationTimeSeconds || defaultCreateOrderOpts.expirationTimeSeconds,
|
||||||
domain: {
|
domain: {
|
||||||
verifyingContractAddress: exchangeAddress,
|
verifyingContract: exchangeAddress,
|
||||||
chainId,
|
chainId,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -118,7 +118,7 @@ function generateEmptyOrder(chainId: number): Order {
|
|||||||
feeRecipientAddress: constants.NULL_ADDRESS,
|
feeRecipientAddress: constants.NULL_ADDRESS,
|
||||||
expirationTimeSeconds: constants.INFINITE_TIMESTAMP_SEC,
|
expirationTimeSeconds: constants.INFINITE_TIMESTAMP_SEC,
|
||||||
domain: {
|
domain: {
|
||||||
verifyingContractAddress: constants.NULL_ADDRESS,
|
verifyingContract: constants.NULL_ADDRESS,
|
||||||
chainId,
|
chainId,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -20,14 +20,14 @@ describe('EIP712 Utils', () => {
|
|||||||
primaryType,
|
primaryType,
|
||||||
{ Test: [{ name: 'testValue', type: 'uint256' }] },
|
{ Test: [{ name: 'testValue', type: 'uint256' }] },
|
||||||
{ testValue: '1' },
|
{ testValue: '1' },
|
||||||
{ chainId: CHAIN_ID, verifyingContractAddress: constants.NULL_ADDRESS },
|
{ chainId: CHAIN_ID, verifyingContract: constants.NULL_ADDRESS },
|
||||||
);
|
);
|
||||||
expect(typedData.domain).to.not.be.undefined();
|
expect(typedData.domain).to.not.be.undefined();
|
||||||
expect(typedData.types.EIP712Domain).to.not.be.undefined();
|
expect(typedData.types.EIP712Domain).to.not.be.undefined();
|
||||||
const domainObject = typedData.domain;
|
const domainObject = typedData.domain;
|
||||||
expect(domainObject.name).to.eq(constants.EXCHANGE_DOMAIN_NAME);
|
expect(domainObject.name).to.eq(constants.EXCHANGE_DOMAIN_NAME);
|
||||||
expect(domainObject.version).to.eq(constants.EXCHANGE_DOMAIN_VERSION);
|
expect(domainObject.version).to.eq(constants.EXCHANGE_DOMAIN_VERSION);
|
||||||
expect(domainObject.verifyingContractAddress).to.eq(constants.NULL_ADDRESS);
|
expect(domainObject.verifyingContract).to.eq(constants.NULL_ADDRESS);
|
||||||
expect(typedData.primaryType).to.eq(primaryType);
|
expect(typedData.primaryType).to.eq(primaryType);
|
||||||
});
|
});
|
||||||
it('adds in the EIP712DomainSeparator without default values', () => {
|
it('adds in the EIP712DomainSeparator without default values', () => {
|
||||||
@ -42,7 +42,7 @@ describe('EIP712 Utils', () => {
|
|||||||
name: domainName,
|
name: domainName,
|
||||||
version: domainVersion,
|
version: domainVersion,
|
||||||
chainId: CHAIN_ID,
|
chainId: CHAIN_ID,
|
||||||
verifyingContractAddress: constants.NULL_ADDRESS,
|
verifyingContract: constants.NULL_ADDRESS,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
expect(typedData.domain).to.not.be.undefined();
|
expect(typedData.domain).to.not.be.undefined();
|
||||||
@ -50,7 +50,7 @@ describe('EIP712 Utils', () => {
|
|||||||
const domainObject = typedData.domain;
|
const domainObject = typedData.domain;
|
||||||
expect(domainObject.name).to.eq(domainName);
|
expect(domainObject.name).to.eq(domainName);
|
||||||
expect(domainObject.version).to.eq(domainVersion);
|
expect(domainObject.version).to.eq(domainVersion);
|
||||||
expect(domainObject.verifyingContractAddress).to.eq(constants.NULL_ADDRESS);
|
expect(domainObject.verifyingContract).to.eq(constants.NULL_ADDRESS);
|
||||||
expect(typedData.primaryType).to.eq(primaryType);
|
expect(typedData.primaryType).to.eq(primaryType);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -63,7 +63,7 @@ describe('EIP712 Utils', () => {
|
|||||||
data: constants.NULL_BYTES,
|
data: constants.NULL_BYTES,
|
||||||
signerAddress: constants.NULL_ADDRESS,
|
signerAddress: constants.NULL_ADDRESS,
|
||||||
domain: {
|
domain: {
|
||||||
verifyingContractAddress: constants.NULL_ADDRESS,
|
verifyingContract: constants.NULL_ADDRESS,
|
||||||
chainId: CHAIN_ID,
|
chainId: CHAIN_ID,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -72,7 +72,7 @@ describe('EIP712 Utils', () => {
|
|||||||
const domainObject = typedData.domain;
|
const domainObject = typedData.domain;
|
||||||
expect(domainObject.name).to.eq(constants.EXCHANGE_DOMAIN_NAME);
|
expect(domainObject.name).to.eq(constants.EXCHANGE_DOMAIN_NAME);
|
||||||
expect(domainObject.version).to.eq(constants.EXCHANGE_DOMAIN_VERSION);
|
expect(domainObject.version).to.eq(constants.EXCHANGE_DOMAIN_VERSION);
|
||||||
expect(domainObject.verifyingContractAddress).to.eq(constants.NULL_ADDRESS);
|
expect(domainObject.verifyingContract).to.eq(constants.NULL_ADDRESS);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -14,7 +14,7 @@ const expect = chai.expect;
|
|||||||
|
|
||||||
describe('Order hashing', () => {
|
describe('Order hashing', () => {
|
||||||
describe('#getOrderHashHex', () => {
|
describe('#getOrderHashHex', () => {
|
||||||
const expectedOrderHash = '0xf64c4b90214e8bd27a7830356a276c45b88fe18e0960fbe5b480167abb23b944';
|
const expectedOrderHash = '0x331cb7e07a757bae130702da6646c26531798c92bcfaf671817268fd2c188531';
|
||||||
const fakeExchangeContractAddress = '0x1dc4c1cefef38a777b15aa20260a54e584b16c48';
|
const fakeExchangeContractAddress = '0x1dc4c1cefef38a777b15aa20260a54e584b16c48';
|
||||||
const fakeChainID = 50;
|
const fakeChainID = 50;
|
||||||
const order: Order = {
|
const order: Order = {
|
||||||
@ -33,7 +33,7 @@ describe('Order hashing', () => {
|
|||||||
takerAssetAmount: new BigNumber(0),
|
takerAssetAmount: new BigNumber(0),
|
||||||
expirationTimeSeconds: new BigNumber(0),
|
expirationTimeSeconds: new BigNumber(0),
|
||||||
domain: {
|
domain: {
|
||||||
verifyingContractAddress: fakeExchangeContractAddress,
|
verifyingContract: fakeExchangeContractAddress,
|
||||||
chainId: fakeChainID,
|
chainId: fakeChainID,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -60,7 +60,7 @@ describe('RemainingFillableCalculator', () => {
|
|||||||
salt: zero,
|
salt: zero,
|
||||||
expirationTimeSeconds: zero,
|
expirationTimeSeconds: zero,
|
||||||
domain: {
|
domain: {
|
||||||
verifyingContractAddress: zeroAddress,
|
verifyingContract: zeroAddress,
|
||||||
chainId,
|
chainId,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -42,13 +42,13 @@ describe('Signature utils', () => {
|
|||||||
takerAssetAmount: new BigNumber(0),
|
takerAssetAmount: new BigNumber(0),
|
||||||
expirationTimeSeconds: new BigNumber(0),
|
expirationTimeSeconds: new BigNumber(0),
|
||||||
domain: {
|
domain: {
|
||||||
verifyingContractAddress: fakeExchangeContractAddress,
|
verifyingContract: fakeExchangeContractAddress,
|
||||||
chainId: fakeChainId,
|
chainId: fakeChainId,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
transaction = {
|
transaction = {
|
||||||
domain: {
|
domain: {
|
||||||
verifyingContractAddress: fakeExchangeContractAddress,
|
verifyingContract: fakeExchangeContractAddress,
|
||||||
chainId: fakeChainId,
|
chainId: fakeChainId,
|
||||||
},
|
},
|
||||||
salt: generatePseudoRandomSalt(),
|
salt: generatePseudoRandomSalt(),
|
||||||
@ -188,7 +188,7 @@ describe('Signature utils', () => {
|
|||||||
describe('#ecSignOrderAsync', () => {
|
describe('#ecSignOrderAsync', () => {
|
||||||
it('should default to eth_sign if eth_signTypedData is unavailable', async () => {
|
it('should default to eth_sign if eth_signTypedData is unavailable', async () => {
|
||||||
const expectedSignature =
|
const expectedSignature =
|
||||||
'0x1c5e6c2a66037230b86a410b1d68108683ee8288d3668af91cab72dde1e1541ca86a50b638ccc743f6194a21dd313e71b4b155b2ad882f874d5d790d37d4623ca203';
|
'0x1bea7883d76c4d8d0cd5915ec613f8dedf3b5f03e6a1f74aa171e700b0becdc8b47ade1ede08a5496ff31e34715bc6ac5da5aba709d3d8989a48127c18ef2f56d503';
|
||||||
|
|
||||||
const fakeProvider = {
|
const fakeProvider = {
|
||||||
async sendAsync(payload: JSONRPCRequestPayload, callback: JSONRPCErrorCallback): Promise<void> {
|
async sendAsync(payload: JSONRPCRequestPayload, callback: JSONRPCErrorCallback): Promise<void> {
|
||||||
@ -384,7 +384,7 @@ describe('Signature utils', () => {
|
|||||||
});
|
});
|
||||||
it('should return the correct signature for signatureHex concatenated as R + S + V', async () => {
|
it('should return the correct signature for signatureHex concatenated as R + S + V', async () => {
|
||||||
const expectedSignature =
|
const expectedSignature =
|
||||||
'0x1c686a55fa3f563115c0f2bc2b1c51964d0b6a05dd5ee862b702275600b7f634970f2275dccc1073f87a916dfde88574385b2d7a3eed0c2bdc08c76bad748d7d9002';
|
'0x1b65b7b6205a4511cc81ec8f1b3eb475b398d60985089a3041c74735109f207e99542c7f0f81b0a988317e89b8280ec72829c8532a04c376f1f1236589c911545002';
|
||||||
const fakeProvider = {
|
const fakeProvider = {
|
||||||
async sendAsync(payload: JSONRPCRequestPayload, callback: JSONRPCErrorCallback): Promise<void> {
|
async sendAsync(payload: JSONRPCRequestPayload, callback: JSONRPCErrorCallback): Promise<void> {
|
||||||
if (payload.method === 'eth_signTypedData') {
|
if (payload.method === 'eth_signTypedData') {
|
||||||
|
@ -14,7 +14,7 @@ const expect = chai.expect;
|
|||||||
|
|
||||||
describe('0x transaction hashing', () => {
|
describe('0x transaction hashing', () => {
|
||||||
describe('#getTransactionHashHex', () => {
|
describe('#getTransactionHashHex', () => {
|
||||||
const expectedTransactionHash = '0x420b19f08d5b09c012f381f4bf80a97740b8629f2bac7f42dd7f6aefbb24f3c0';
|
const expectedTransactionHash = '0x7845d260300acfbebaff52f0462f984016473290b9eb865fb6ffac0503cab364';
|
||||||
const fakeVerifyingContractAddress = '0x5e72914535f202659083db3a02c984188fa26e9f';
|
const fakeVerifyingContractAddress = '0x5e72914535f202659083db3a02c984188fa26e9f';
|
||||||
const fakeChainId = 1337;
|
const fakeChainId = 1337;
|
||||||
const transaction: ZeroExTransaction = {
|
const transaction: ZeroExTransaction = {
|
||||||
@ -24,7 +24,7 @@ describe('0x transaction hashing', () => {
|
|||||||
gasPrice: new BigNumber(0),
|
gasPrice: new BigNumber(0),
|
||||||
data: constants.NULL_BYTES,
|
data: constants.NULL_BYTES,
|
||||||
domain: {
|
domain: {
|
||||||
verifyingContractAddress: fakeVerifyingContractAddress,
|
verifyingContract: fakeVerifyingContractAddress,
|
||||||
chainId: fakeChainId,
|
chainId: fakeChainId,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -807,7 +807,7 @@ export interface EIP712DomainWithDefaultSchema {
|
|||||||
name?: string;
|
name?: string;
|
||||||
version?: string;
|
version?: string;
|
||||||
chainId: number;
|
chainId: number;
|
||||||
verifyingContractAddress: string;
|
verifyingContract: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum OrderStatus {
|
export enum OrderStatus {
|
||||||
|
@ -46,7 +46,7 @@ export const signTypedDataUtils = {
|
|||||||
{ name: 'name', type: 'string' },
|
{ name: 'name', type: 'string' },
|
||||||
{ name: 'version', type: 'string' },
|
{ name: 'version', type: 'string' },
|
||||||
{ name: 'chainId', type: 'uint256' },
|
{ name: 'chainId', type: 'uint256' },
|
||||||
{ name: 'verifyingContractAddress', type: 'address' },
|
{ name: 'verifyingContract', type: 'address' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -36,7 +36,7 @@ describe('signTypedDataUtils', () => {
|
|||||||
},
|
},
|
||||||
primaryType: 'Test',
|
primaryType: 'Test',
|
||||||
};
|
};
|
||||||
const orderSignTypedDataHashHex = '0xc59d01479d63bda79d1c7fefc883a81ff247f9a1f9168c748922cd7e0dcd5eca';
|
const orderSignTypedDataHashHex = '0x78772b297e1b0b31089589a6608930cceba855af9d3ccf7b92cf47fa881e21f7';
|
||||||
const orderSignTypedData = {
|
const orderSignTypedData = {
|
||||||
types: {
|
types: {
|
||||||
EIP712Domain: [
|
EIP712Domain: [
|
||||||
@ -53,7 +53,7 @@ describe('signTypedDataUtils', () => {
|
|||||||
type: 'uint256',
|
type: 'uint256',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'verifyingContractAddress',
|
name: 'verifyingContract',
|
||||||
type: 'address',
|
type: 'address',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@ -112,7 +112,7 @@ describe('signTypedDataUtils', () => {
|
|||||||
name: '0x Protocol',
|
name: '0x Protocol',
|
||||||
version: '2',
|
version: '2',
|
||||||
chainId: 1337,
|
chainId: 1337,
|
||||||
verifyingContractAddress: '0x0000000000000000000000000000000000000000',
|
verifyingContract: '0x0000000000000000000000000000000000000000',
|
||||||
},
|
},
|
||||||
message: {
|
message: {
|
||||||
makerAddress: '0x0000000000000000000000000000000000000000',
|
makerAddress: '0x0000000000000000000000000000000000000000',
|
||||||
@ -160,7 +160,7 @@ describe('signTypedDataUtils', () => {
|
|||||||
};
|
};
|
||||||
const hash = signTypedDataUtils.generateTypedDataHash(uninitializedOrder).toString('hex');
|
const hash = signTypedDataUtils.generateTypedDataHash(uninitializedOrder).toString('hex');
|
||||||
const hashHex = `0x${hash}`;
|
const hashHex = `0x${hash}`;
|
||||||
expect(hashHex).to.be.eq('0x7624dcf06a5ba0e2799a87adba76a13c7d6418214d6b3c9bc239fdf2422f2027');
|
expect(hashHex).to.be.eq('0x510449a190415c4770080d857a1c654b653a0c054c94a7a8e9f08f623f9e824f');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user