Update coordinator
, exchange-forwarder
, exchange-libs
, exchange
, and extensions
contract tests to use new order and transaction structure
This commit is contained in:
parent
259b463b73
commit
b8f056b82f
@ -101,13 +101,15 @@ describe('Coordinator tests', () => {
|
||||
// Configure order defaults
|
||||
const defaultOrderParams = {
|
||||
...devConstants.STATIC_ORDER_PARAMS,
|
||||
exchangeAddress: exchange.address,
|
||||
chainId,
|
||||
senderAddress: coordinatorContract.address,
|
||||
makerAddress,
|
||||
feeRecipientAddress,
|
||||
makerAssetData: assetDataUtils.encodeERC20AssetData(erc20TokenA.address),
|
||||
takerAssetData: assetDataUtils.encodeERC20AssetData(erc20TokenB.address),
|
||||
domain: {
|
||||
verifyingContractAddress: exchange.address,
|
||||
chainId,
|
||||
},
|
||||
};
|
||||
const makerPrivateKey = devConstants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(makerAddress)];
|
||||
const takerPrivateKey = devConstants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(takerAddress)];
|
||||
@ -115,7 +117,7 @@ describe('Coordinator tests', () => {
|
||||
orderFactory = new OrderFactory(makerPrivateKey, defaultOrderParams);
|
||||
makerTransactionFactory = new TransactionFactory(makerPrivateKey, exchange.address, chainId);
|
||||
takerTransactionFactory = new TransactionFactory(takerPrivateKey, exchange.address, chainId);
|
||||
approvalFactory = new ApprovalFactory(feeRecipientPrivateKey, coordinatorContract.address, chainId);
|
||||
approvalFactory = new ApprovalFactory(feeRecipientPrivateKey, coordinatorContract.address);
|
||||
});
|
||||
beforeEach(async () => {
|
||||
await blockchainLifecycle.startAsync();
|
||||
|
@ -41,11 +41,13 @@ describe('Libs tests', () => {
|
||||
describe('getTransactionHash', () => {
|
||||
it('should return the correct transaction hash', async () => {
|
||||
const tx = {
|
||||
verifyingContractAddress: exchangeAddress,
|
||||
chainId,
|
||||
salt: new BigNumber(0),
|
||||
signerAddress: constants.NULL_ADDRESS,
|
||||
data: '0x1234',
|
||||
domain: {
|
||||
verifyingContractAddress: exchangeAddress,
|
||||
chainId,
|
||||
},
|
||||
};
|
||||
const expectedTxHash = transactionHashUtils.getTransactionHashHex(tx);
|
||||
const txHash = await coordinatorContract.getTransactionHash.callAsync(tx);
|
||||
@ -56,12 +58,14 @@ describe('Libs tests', () => {
|
||||
describe('getApprovalHash', () => {
|
||||
it('should return the correct approval hash', async () => {
|
||||
const signedTx = {
|
||||
verifyingContractAddress: exchangeAddress,
|
||||
chainId,
|
||||
salt: new BigNumber(0),
|
||||
signerAddress: constants.NULL_ADDRESS,
|
||||
data: '0x1234',
|
||||
signature: '0x5678',
|
||||
domain: {
|
||||
verifyingContractAddress: exchangeAddress,
|
||||
chainId,
|
||||
},
|
||||
};
|
||||
const approvalExpirationTimeSeconds = new BigNumber(0);
|
||||
const txOrigin = constants.NULL_ADDRESS;
|
||||
|
@ -11,7 +11,12 @@ import {
|
||||
} from '@0x/contracts-test-utils';
|
||||
import { BlockchainLifecycle } from '@0x/dev-utils';
|
||||
import { transactionHashUtils } from '@0x/order-utils';
|
||||
import { RevertReason, SignatureType, SignedOrder } from '@0x/types';
|
||||
import {
|
||||
EIP712DomainWithDefaultSchema,
|
||||
RevertReason,
|
||||
SignatureType,
|
||||
SignedOrder
|
||||
} from '@0x/types';
|
||||
import { BigNumber, providerUtils } from '@0x/utils';
|
||||
import * as chai from 'chai';
|
||||
import * as ethUtil from 'ethereumjs-util';
|
||||
@ -33,6 +38,7 @@ describe('Mixins tests', () => {
|
||||
let approvalFactory2: ApprovalFactory;
|
||||
let defaultOrder: SignedOrder;
|
||||
const exchangeAddress = addressUtils.generatePseudoRandomAddress();
|
||||
let exchangeDomain: EIP712DomainWithDefaultSchema;
|
||||
|
||||
before(async () => {
|
||||
await blockchainLifecycle.startAsync();
|
||||
@ -51,9 +57,11 @@ describe('Mixins tests', () => {
|
||||
);
|
||||
const accounts = await web3Wrapper.getAvailableAddressesAsync();
|
||||
[transactionSignerAddress, approvalSignerAddress1, approvalSignerAddress2] = accounts.slice(0, 3);
|
||||
defaultOrder = {
|
||||
exchangeAddress: devConstants.NULL_ADDRESS,
|
||||
exchangeDomain = {
|
||||
verifyingContractAddress: devConstants.NULL_ADDRESS,
|
||||
chainId,
|
||||
};
|
||||
defaultOrder = {
|
||||
makerAddress: devConstants.NULL_ADDRESS,
|
||||
takerAddress: devConstants.NULL_ADDRESS,
|
||||
senderAddress: mixins.address,
|
||||
@ -67,14 +75,15 @@ describe('Mixins tests', () => {
|
||||
expirationTimeSeconds: devConstants.ZERO_AMOUNT,
|
||||
salt: devConstants.ZERO_AMOUNT,
|
||||
signature: devConstants.NULL_BYTES,
|
||||
domain: exchangeDomain,
|
||||
};
|
||||
const transactionSignerPrivateKey =
|
||||
devConstants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(transactionSignerAddress)];
|
||||
const approvalSignerPrivateKey1 = devConstants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(approvalSignerAddress1)];
|
||||
const approvalSignerPrivateKey2 = devConstants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(approvalSignerAddress2)];
|
||||
transactionFactory = new TransactionFactory(transactionSignerPrivateKey, exchangeAddress, chainId);
|
||||
approvalFactory1 = new ApprovalFactory(approvalSignerPrivateKey1, mixins.address, chainId);
|
||||
approvalFactory2 = new ApprovalFactory(approvalSignerPrivateKey2, mixins.address, chainId);
|
||||
approvalFactory1 = new ApprovalFactory(approvalSignerPrivateKey1, mixins.address);
|
||||
approvalFactory2 = new ApprovalFactory(approvalSignerPrivateKey2, mixins.address);
|
||||
});
|
||||
beforeEach(async () => {
|
||||
await blockchainLifecycle.startAsync();
|
||||
@ -147,9 +156,8 @@ describe('Mixins tests', () => {
|
||||
const decodedOrders = await mixins.decodeOrdersFromFillData.callAsync(data);
|
||||
const decodedSignedOrders = decodedOrders.map(order => ({
|
||||
...order,
|
||||
exchangeAddress: devConstants.NULL_ADDRESS,
|
||||
chainId,
|
||||
signature: devConstants.NULL_BYTES,
|
||||
domain: exchangeDomain,
|
||||
}));
|
||||
expect(orders).to.deep.eq(decodedSignedOrders);
|
||||
});
|
||||
@ -161,9 +169,8 @@ describe('Mixins tests', () => {
|
||||
const decodedOrders = await mixins.decodeOrdersFromFillData.callAsync(data);
|
||||
const decodedSignedOrders = decodedOrders.map(order => ({
|
||||
...order,
|
||||
exchangeAddress: devConstants.NULL_ADDRESS,
|
||||
chainId,
|
||||
signature: devConstants.NULL_BYTES,
|
||||
domain: exchangeDomain,
|
||||
}));
|
||||
expect(orders).to.deep.eq(decodedSignedOrders);
|
||||
});
|
||||
@ -175,9 +182,8 @@ describe('Mixins tests', () => {
|
||||
const decodedOrders = await mixins.decodeOrdersFromFillData.callAsync(data);
|
||||
const decodedSignedOrders = decodedOrders.map(order => ({
|
||||
...order,
|
||||
exchangeAddress: devConstants.NULL_ADDRESS,
|
||||
chainId,
|
||||
signature: devConstants.NULL_BYTES,
|
||||
domain: exchangeDomain,
|
||||
}));
|
||||
expect(orders).to.deep.eq(decodedSignedOrders);
|
||||
});
|
||||
|
@ -9,7 +9,7 @@ export class ApprovalFactory {
|
||||
private readonly _privateKey: Buffer;
|
||||
private readonly _verifyingContractAddress: string;
|
||||
|
||||
constructor(privateKey: Buffer, verifyingContractAddress: string, chainId: number) {
|
||||
constructor(privateKey: Buffer, verifyingContractAddress: string) {
|
||||
this._privateKey = privateKey;
|
||||
this._verifyingContractAddress = verifyingContractAddress;
|
||||
}
|
||||
|
@ -26,7 +26,11 @@ export const hashUtils = {
|
||||
approvalExpirationTimeSeconds: BigNumber,
|
||||
): string {
|
||||
const hashHex = `0x${hashUtils
|
||||
.getApprovalHashBuffer(transaction, verifyingContractAddress, txOrigin, approvalExpirationTimeSeconds)
|
||||
.getApprovalHashBuffer(
|
||||
transaction,
|
||||
verifyingContractAddress,
|
||||
txOrigin, approvalExpirationTimeSeconds,
|
||||
)
|
||||
.toString('hex')}`;
|
||||
return hashHex;
|
||||
},
|
||||
|
@ -119,8 +119,6 @@ describe(ContractName.Forwarder, () => {
|
||||
defaultMakerAssetAddress = erc20TokenA.address;
|
||||
const defaultTakerAssetAddress = wethContract.address;
|
||||
const defaultOrderParams = {
|
||||
exchangeAddress: exchangeInstance.address,
|
||||
chainId,
|
||||
makerAddress,
|
||||
feeRecipientAddress,
|
||||
makerAssetData: assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress),
|
||||
@ -129,6 +127,10 @@ describe(ContractName.Forwarder, () => {
|
||||
takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), DECIMALS_DEFAULT),
|
||||
makerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), DECIMALS_DEFAULT),
|
||||
takerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(0), DECIMALS_DEFAULT),
|
||||
domain: {
|
||||
verifyingContractAddress: exchangeInstance.address,
|
||||
chainId,
|
||||
},
|
||||
};
|
||||
const privateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(makerAddress)];
|
||||
orderFactory = new OrderFactory(privateKey, defaultOrderParams);
|
||||
|
@ -59,12 +59,14 @@ describe('Exchange libs', () => {
|
||||
|
||||
const defaultOrderParams = {
|
||||
...constants.STATIC_ORDER_PARAMS,
|
||||
exchangeAddress: libs.address,
|
||||
chainId,
|
||||
makerAddress,
|
||||
feeRecipientAddress: addressUtils.generatePseudoRandomAddress(),
|
||||
makerAssetData: assetDataUtils.encodeERC20AssetData(addressUtils.generatePseudoRandomAddress()),
|
||||
takerAssetData: assetDataUtils.encodeERC20AssetData(addressUtils.generatePseudoRandomAddress()),
|
||||
domain: {
|
||||
verifyingContractAddress: libs.address,
|
||||
chainId,
|
||||
},
|
||||
};
|
||||
const privateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(makerAddress)];
|
||||
orderFactory = new OrderFactory(privateKey, defaultOrderParams);
|
||||
|
@ -208,12 +208,14 @@ describe('Exchange core', () => {
|
||||
defaultTakerAssetAddress = erc20TokenB.address;
|
||||
const defaultOrderParams = {
|
||||
...constants.STATIC_ORDER_PARAMS,
|
||||
exchangeAddress: exchange.address,
|
||||
chainId,
|
||||
makerAddress,
|
||||
feeRecipientAddress,
|
||||
makerAssetData: assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress),
|
||||
takerAssetData: assetDataUtils.encodeERC20AssetData(defaultTakerAssetAddress),
|
||||
domain: {
|
||||
verifyingContractAddress: exchange.address,
|
||||
chainId,
|
||||
},
|
||||
};
|
||||
const privateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(makerAddress)];
|
||||
orderFactory = new OrderFactory(privateKey, defaultOrderParams);
|
||||
|
@ -36,10 +36,12 @@ const emptyOrder: Order = {
|
||||
makerAssetData: '0x',
|
||||
takerAssetData: '0x',
|
||||
salt: new BigNumber(0),
|
||||
exchangeAddress: constants.NULL_ADDRESS,
|
||||
chainId: 0, // To be filled in later.
|
||||
feeRecipientAddress: constants.NULL_ADDRESS,
|
||||
expirationTimeSeconds: new BigNumber(0),
|
||||
domain: {
|
||||
verifyingContractAddress: constants.NULL_ADDRESS,
|
||||
chainId: 0, // To be filled in later.
|
||||
},
|
||||
};
|
||||
|
||||
const emptySignedOrder: SignedOrder = {
|
||||
@ -64,8 +66,8 @@ describe('Exchange core internal functions', () => {
|
||||
});
|
||||
before(async () => {
|
||||
chainId = await providerUtils.getChainIdAsync(provider);
|
||||
emptyOrder.chainId = chainId;
|
||||
emptySignedOrder.chainId = chainId;
|
||||
emptyOrder.domain.chainId = chainId;
|
||||
emptySignedOrder.domain.chainId = chainId;
|
||||
|
||||
testExchange = await TestExchangeInternalsContract.deployFrom0xArtifactAsync(
|
||||
artifacts.TestExchangeInternals,
|
||||
|
@ -152,24 +152,26 @@ describe('matchOrders', () => {
|
||||
defaultERC20MakerAssetAddress = erc20TokenA.address;
|
||||
defaultERC20TakerAssetAddress = erc20TokenB.address;
|
||||
defaultERC721AssetAddress = erc721Token.address;
|
||||
const domain = {
|
||||
verifyingContractAddress: exchange.address,
|
||||
chainId,
|
||||
};
|
||||
// Create default order parameters
|
||||
const defaultOrderParamsLeft = {
|
||||
...constants.STATIC_ORDER_PARAMS,
|
||||
makerAddress: makerAddressLeft,
|
||||
exchangeAddress: exchange.address,
|
||||
chainId,
|
||||
makerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
|
||||
takerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
|
||||
feeRecipientAddress: feeRecipientAddressLeft,
|
||||
domain,
|
||||
};
|
||||
const defaultOrderParamsRight = {
|
||||
...constants.STATIC_ORDER_PARAMS,
|
||||
makerAddress: makerAddressRight,
|
||||
exchangeAddress: exchange.address,
|
||||
chainId,
|
||||
makerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
|
||||
takerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
|
||||
feeRecipientAddress: feeRecipientAddressRight,
|
||||
domain,
|
||||
};
|
||||
const privateKeyLeft = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(makerAddressLeft)];
|
||||
orderFactoryLeft = new OrderFactory(privateKeyLeft, defaultOrderParamsLeft);
|
||||
|
@ -101,12 +101,14 @@ describe('MixinSignatureValidator', () => {
|
||||
|
||||
const defaultOrderParams = {
|
||||
...constants.STATIC_ORDER_PARAMS,
|
||||
exchangeAddress: signatureValidator.address,
|
||||
chainId,
|
||||
makerAddress,
|
||||
feeRecipientAddress: addressUtils.generatePseudoRandomAddress(),
|
||||
makerAssetData: assetDataUtils.encodeERC20AssetData(addressUtils.generatePseudoRandomAddress()),
|
||||
takerAssetData: assetDataUtils.encodeERC20AssetData(addressUtils.generatePseudoRandomAddress()),
|
||||
domain: {
|
||||
verifyingContractAddress: signatureValidator.address,
|
||||
chainId,
|
||||
},
|
||||
};
|
||||
signerPrivateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(makerAddress)];
|
||||
notSignerPrivateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(notSignerAddress)];
|
||||
|
@ -14,7 +14,13 @@ import {
|
||||
} from '@0x/contracts-test-utils';
|
||||
import { BlockchainLifecycle } from '@0x/dev-utils';
|
||||
import { assetDataUtils, generatePseudoRandomSalt } from '@0x/order-utils';
|
||||
import { OrderWithoutExchangeAddress, RevertReason, SignedOrder, SignedZeroExTransaction } from '@0x/types';
|
||||
import {
|
||||
EIP712DomainWithDefaultSchema,
|
||||
OrderWithoutDomain,
|
||||
RevertReason,
|
||||
SignedOrder,
|
||||
SignedZeroExTransaction
|
||||
} from '@0x/types';
|
||||
import { BigNumber, providerUtils } from '@0x/utils';
|
||||
import * as chai from 'chai';
|
||||
import * as _ from 'lodash';
|
||||
@ -40,9 +46,10 @@ describe('Exchange transactions', () => {
|
||||
let erc20Proxy: ERC20ProxyContract;
|
||||
|
||||
let erc20Balances: ERC20BalancesByOwner;
|
||||
let domain: EIP712DomainWithDefaultSchema;
|
||||
let signedOrder: SignedOrder;
|
||||
let signedTx: SignedZeroExTransaction;
|
||||
let orderWithoutExchangeAddress: OrderWithoutExchangeAddress;
|
||||
let orderWithoutExchangeAddress: OrderWithoutDomain;
|
||||
let orderFactory: OrderFactory;
|
||||
let makerTransactionFactory: TransactionFactory;
|
||||
let takerTransactionFactory: TransactionFactory;
|
||||
@ -103,15 +110,19 @@ describe('Exchange transactions', () => {
|
||||
defaultMakerTokenAddress = erc20TokenA.address;
|
||||
defaultTakerTokenAddress = erc20TokenB.address;
|
||||
|
||||
domain = {
|
||||
verifyingContractAddress: exchange.address,
|
||||
chainId,
|
||||
};
|
||||
|
||||
const defaultOrderParams = {
|
||||
...constants.STATIC_ORDER_PARAMS,
|
||||
senderAddress,
|
||||
exchangeAddress: exchange.address,
|
||||
chainId,
|
||||
makerAddress,
|
||||
feeRecipientAddress,
|
||||
makerAssetData: assetDataUtils.encodeERC20AssetData(defaultMakerTokenAddress),
|
||||
takerAssetData: assetDataUtils.encodeERC20AssetData(defaultTakerTokenAddress),
|
||||
domain,
|
||||
};
|
||||
makerPrivateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(makerAddress)];
|
||||
takerPrivateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(takerAddress)];
|
||||
@ -125,7 +136,7 @@ describe('Exchange transactions', () => {
|
||||
beforeEach(async () => {
|
||||
erc20Balances = await erc20Wrapper.getBalancesAsync();
|
||||
signedOrder = await orderFactory.newSignedOrderAsync();
|
||||
orderWithoutExchangeAddress = orderUtils.getOrderWithoutExchangeAddress(signedOrder);
|
||||
orderWithoutExchangeAddress = orderUtils.getOrderWithoutDomain(signedOrder);
|
||||
|
||||
takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
|
||||
const data = exchange.fillOrder.getABIEncodedTransactionData(
|
||||
@ -246,7 +257,7 @@ describe('Exchange transactions', () => {
|
||||
);
|
||||
|
||||
const takerAssetFillAmount = signedOrder.takerAssetAmount;
|
||||
orderWithoutExchangeAddress = orderUtils.getOrderWithoutExchangeAddress(signedOrder);
|
||||
orderWithoutExchangeAddress = orderUtils.getOrderWithoutDomain(signedOrder);
|
||||
const fillData = exchange.fillOrder.getABIEncodedTransactionData(
|
||||
orderWithoutExchangeAddress,
|
||||
takerAssetFillAmount,
|
||||
@ -277,7 +288,7 @@ describe('Exchange transactions', () => {
|
||||
|
||||
erc20Balances = await erc20Wrapper.getBalancesAsync();
|
||||
const takerAssetFillAmount = signedOrder.takerAssetAmount;
|
||||
orderWithoutExchangeAddress = orderUtils.getOrderWithoutExchangeAddress(signedOrder);
|
||||
orderWithoutExchangeAddress = orderUtils.getOrderWithoutDomain(signedOrder);
|
||||
const data = exchange.fillOrder.getABIEncodedTransactionData(
|
||||
orderWithoutExchangeAddress,
|
||||
takerAssetFillAmount,
|
||||
@ -349,12 +360,11 @@ describe('Exchange transactions', () => {
|
||||
const defaultOrderParams = {
|
||||
...constants.STATIC_ORDER_PARAMS,
|
||||
senderAddress: whitelist.address,
|
||||
exchangeAddress: exchange.address,
|
||||
chainId,
|
||||
makerAddress,
|
||||
feeRecipientAddress,
|
||||
makerAssetData: assetDataUtils.encodeERC20AssetData(defaultMakerTokenAddress),
|
||||
takerAssetData: assetDataUtils.encodeERC20AssetData(defaultTakerTokenAddress),
|
||||
domain,
|
||||
};
|
||||
whitelistOrderFactory = new OrderFactory(makerPrivateKey, defaultOrderParams);
|
||||
});
|
||||
@ -371,7 +381,7 @@ describe('Exchange transactions', () => {
|
||||
constants.AWAIT_TRANSACTION_MINED_MS,
|
||||
);
|
||||
|
||||
orderWithoutExchangeAddress = orderUtils.getOrderWithoutExchangeAddress(signedOrder);
|
||||
orderWithoutExchangeAddress = orderUtils.getOrderWithoutDomain(signedOrder);
|
||||
const takerAssetFillAmount = signedOrder.takerAssetAmount;
|
||||
const salt = generatePseudoRandomSalt();
|
||||
return expectTransactionFailedAsync(
|
||||
@ -393,7 +403,7 @@ describe('Exchange transactions', () => {
|
||||
constants.AWAIT_TRANSACTION_MINED_MS,
|
||||
);
|
||||
|
||||
orderWithoutExchangeAddress = orderUtils.getOrderWithoutExchangeAddress(signedOrder);
|
||||
orderWithoutExchangeAddress = orderUtils.getOrderWithoutDomain(signedOrder);
|
||||
const takerAssetFillAmount = signedOrder.takerAssetAmount;
|
||||
const salt = generatePseudoRandomSalt();
|
||||
return expectTransactionFailedAsync(
|
||||
@ -420,7 +430,7 @@ describe('Exchange transactions', () => {
|
||||
constants.AWAIT_TRANSACTION_MINED_MS,
|
||||
);
|
||||
|
||||
orderWithoutExchangeAddress = orderUtils.getOrderWithoutExchangeAddress(signedOrder);
|
||||
orderWithoutExchangeAddress = orderUtils.getOrderWithoutDomain(signedOrder);
|
||||
const takerAssetFillAmount = signedOrder.takerAssetAmount;
|
||||
const salt = generatePseudoRandomSalt();
|
||||
await web3Wrapper.awaitTransactionSuccessAsync(
|
||||
|
@ -287,10 +287,12 @@ export class OrderFactoryFromScenario {
|
||||
makerAssetData,
|
||||
takerAssetData,
|
||||
salt: generatePseudoRandomSalt(),
|
||||
exchangeAddress: this._exchangeAddress,
|
||||
chainId: this._chainId,
|
||||
feeRecipientAddress,
|
||||
expirationTimeSeconds,
|
||||
domain: {
|
||||
verifyingContractAddress: this._exchangeAddress,
|
||||
chainId: this._chainId,
|
||||
},
|
||||
};
|
||||
|
||||
return order;
|
||||
|
@ -121,12 +121,14 @@ describe('Exchange wrappers', () => {
|
||||
|
||||
const defaultOrderParams = {
|
||||
...constants.STATIC_ORDER_PARAMS,
|
||||
exchangeAddress: exchange.address,
|
||||
chainId,
|
||||
makerAddress,
|
||||
feeRecipientAddress,
|
||||
makerAssetData: assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress),
|
||||
takerAssetData: assetDataUtils.encodeERC20AssetData(defaultTakerAssetAddress),
|
||||
domain: {
|
||||
verifyingContractAddress: exchange.address,
|
||||
chainId,
|
||||
},
|
||||
};
|
||||
const privateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(makerAddress)];
|
||||
orderFactory = new OrderFactory(privateKey, defaultOrderParams);
|
||||
|
@ -167,8 +167,6 @@ describe(ContractName.BalanceThresholdFilter, () => {
|
||||
);
|
||||
// Default order parameters
|
||||
defaultOrderParams = {
|
||||
exchangeAddress: exchangeInstance.address,
|
||||
chainId,
|
||||
feeRecipientAddress,
|
||||
makerAssetData: assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress),
|
||||
takerAssetData: assetDataUtils.encodeERC20AssetData(defaultTakerAssetAddress),
|
||||
@ -177,6 +175,10 @@ describe(ContractName.BalanceThresholdFilter, () => {
|
||||
makerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), DECIMALS_DEFAULT),
|
||||
takerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(150), DECIMALS_DEFAULT),
|
||||
senderAddress: erc721BalanceThresholdFilterInstance.address,
|
||||
domain: {
|
||||
verifyingContractAddress: exchangeInstance.address,
|
||||
chainId,
|
||||
},
|
||||
};
|
||||
// Create two order factories with valid makers (who meet the threshold balance), and
|
||||
// one factory for an invalid address (that does not meet the threshold balance)
|
||||
|
@ -148,8 +148,6 @@ describe(ContractName.DutchAuction, () => {
|
||||
// Default sell order and buy order are exact mirrors
|
||||
const sellerDefaultOrderParams = {
|
||||
salt: generatePseudoRandomSalt(),
|
||||
exchangeAddress: exchangeInstance.address,
|
||||
chainId,
|
||||
makerAddress,
|
||||
feeRecipientAddress,
|
||||
// taker address or sender address should be set to the ducth auction contract
|
||||
@ -165,6 +163,10 @@ describe(ContractName.DutchAuction, () => {
|
||||
expirationTimeSeconds: auctionEndTimeSeconds,
|
||||
makerFee: constants.ZERO_AMOUNT,
|
||||
takerFee: constants.ZERO_AMOUNT,
|
||||
domain: {
|
||||
verifyingContractAddress: exchangeInstance.address,
|
||||
chainId,
|
||||
},
|
||||
};
|
||||
// Default buy order is for the auction begin price
|
||||
const buyerDefaultOrderParams = {
|
||||
|
@ -163,28 +163,32 @@ describe('OrderMatcher', () => {
|
||||
),
|
||||
constants.AWAIT_TRANSACTION_MINED_MS,
|
||||
);
|
||||
|
||||
const domain = {
|
||||
verifyingContractAddress: exchange.address,
|
||||
chainId,
|
||||
};
|
||||
|
||||
// Create default order parameters
|
||||
const defaultOrderParamsLeft = {
|
||||
...constants.STATIC_ORDER_PARAMS,
|
||||
makerAddress: makerAddressLeft,
|
||||
exchangeAddress: exchange.address,
|
||||
chainId,
|
||||
makerAssetData: leftMakerAssetData,
|
||||
takerAssetData: leftTakerAssetData,
|
||||
feeRecipientAddress: feeRecipientAddressLeft,
|
||||
makerFee: constants.ZERO_AMOUNT,
|
||||
takerFee: constants.ZERO_AMOUNT,
|
||||
domain,
|
||||
};
|
||||
const defaultOrderParamsRight = {
|
||||
...constants.STATIC_ORDER_PARAMS,
|
||||
makerAddress: makerAddressRight,
|
||||
exchangeAddress: exchange.address,
|
||||
chainId,
|
||||
makerAssetData: leftTakerAssetData,
|
||||
takerAssetData: leftMakerAssetData,
|
||||
feeRecipientAddress: feeRecipientAddressRight,
|
||||
makerFee: constants.ZERO_AMOUNT,
|
||||
takerFee: constants.ZERO_AMOUNT,
|
||||
domain,
|
||||
};
|
||||
const privateKeyLeft = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(makerAddressLeft)];
|
||||
orderFactoryLeft = new OrderFactory(privateKeyLeft, defaultOrderParamsLeft);
|
||||
|
Loading…
x
Reference in New Issue
Block a user