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