address comments

This commit is contained in:
Michael Zhu 2019-10-17 19:53:43 -07:00
parent ffac52f42e
commit b45ec47eee
2 changed files with 19 additions and 16 deletions

View File

@ -40,8 +40,8 @@ export class FillOrderWrapper {
txReceipt: TransactionReceiptWithDecodedLogs, txReceipt: TransactionReceiptWithDecodedLogs,
signedOrder: SignedOrder, signedOrder: SignedOrder,
takerAddress: string, takerAddress: string,
opts: { takerAssetFillAmount?: BigNumber } = {},
initBalanceStore: BalanceStore, initBalanceStore: BalanceStore,
opts: { takerAssetFillAmount?: BigNumber } = {},
): [FillResults, FillEventArgs, BalanceStore] { ): [FillResults, FillEventArgs, BalanceStore] {
const balanceStore = LocalBalanceStore.create(initBalanceStore); const balanceStore = LocalBalanceStore.create(initBalanceStore);
const takerAssetFillAmount = const takerAssetFillAmount =
@ -168,7 +168,7 @@ export class FillOrderWrapper {
simulatedFillResults, simulatedFillResults,
simulatedFillEvent, simulatedFillEvent,
simulatedFinalBalanceStore, simulatedFinalBalanceStore,
] = FillOrderWrapper.simulateFillOrder(txReceipt, signedOrder, from, opts, this._blockchainBalanceStore); ] = FillOrderWrapper.simulateFillOrder(txReceipt, signedOrder, from, this._blockchainBalanceStore, opts);
// Assert state transition // Assert state transition
expect(simulatedFillResults, 'Fill Results').to.be.deep.equal(fillResults); expect(simulatedFillResults, 'Fill Results').to.be.deep.equal(fillResults);
expect(simulatedFillEvent, 'Fill Events').to.be.deep.equal(fillEvent); expect(simulatedFillEvent, 'Fill Events').to.be.deep.equal(fillEvent);

View File

@ -222,23 +222,26 @@ blockchainTests.resets('Exchange core', () => {
}; };
const privateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(makerAddress)]; const privateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(makerAddress)];
orderFactory = new OrderFactory(privateKey, defaultOrderParams); orderFactory = new OrderFactory(privateKey, defaultOrderParams);
const tokenContracts = {
erc20: { erc20TokenA, erc20TokenB, feeToken, noReturnErc20Token },
erc721: { erc721Token },
erc1155: { erc1155Contract },
};
const tokenIds = {
erc721: { [erc721Token.address]: [...erc721MakerAssetIds, ...erc721TakerAssetIds] },
erc1155: {
[erc1155Contract.address]: {
fungible: erc1155FungibleTokens,
nonFungible: [...erc1155NonFungibleTokensOwnedByMaker, ...erc1155NonFungibleTokensOwnedByTaker],
},
},
};
fillOrderWrapper = new FillOrderWrapper( fillOrderWrapper = new FillOrderWrapper(
exchange, exchange,
{ makerAddress, takerAddress, feeRecipientAddress }, { makerAddress, takerAddress, feeRecipientAddress },
{ tokenContracts,
erc20: { erc20TokenA, erc20TokenB, feeToken, noReturnErc20Token }, tokenIds,
erc721: { erc721Token },
erc1155: { erc1155Contract },
},
{
erc721: { [erc721Token.address]: [...erc721MakerAssetIds, ...erc721TakerAssetIds] },
erc1155: {
[erc1155Contract.address]: {
fungible: erc1155FungibleTokens,
nonFungible: [...erc1155NonFungibleTokensOwnedByMaker, ...erc1155NonFungibleTokensOwnedByTaker],
},
},
},
); );
}); });
describe('fillOrder', () => { describe('fillOrder', () => {