Code to validate addresses from order arrays

This commit is contained in:
Greg Hysen
2018-12-03 16:36:19 -08:00
parent bab7569ed9
commit a332c5e5c2
2 changed files with 49 additions and 8 deletions

View File

@@ -206,7 +206,7 @@ describe.only(ContractName.CompliantForwarder, () => {
afterEach(async () => {
await blockchainLifecycle.revertAsync();
});
describe.only('fillOrder', () => {
describe('fillOrder', () => {
beforeEach(async () => {
erc20Balances = await erc20Wrapper.getBalancesAsync();
});
@@ -334,6 +334,32 @@ describe.only(ContractName.CompliantForwarder, () => {
);
});
});
describe.only('batchFillOrders', () => {
beforeEach(async () => {
erc20Balances = await erc20Wrapper.getBalancesAsync();
});
it.only ('should transfer the correct amounts when maker and taker are compliant', async () => {
let order2 = _.cloneDeep(compliantSignedOrder);
order2.makerAddress = `0x${_.reverse(compliantSignedOrder.makerAddress.slice(2).split('')).join('')}`;
const orders = [compliantSignedOrder, order2];
const fillAmounts = [new BigNumber(4), new BigNumber(4)];
const signatures = ["0xabcd", "0xabcd"];
const exchangeCalldata = exchangeInstance.batchFillOrders.getABIEncodedTransactionData(orders, fillAmounts, signatures);
console.log('*'.repeat(40), exchangeCalldata, '*'.repeat(40));
console.log('****** MAKER ADDRESS = ', compliantSignedOrder.makerAddress);
const txHash = await compliantForwarderInstance.executeTransaction.sendTransactionAsync(
compliantSignedFillOrderTx.salt,
compliantSignedFillOrderTx.signerAddress,
exchangeCalldata,
compliantSignedFillOrderTx.signature,
);
const decoder = new LogDecoder(web3Wrapper);
const tx = await decoder.getTxWithDecodedLogsAsync(txHash);
console.log(JSON.stringify(tx, null, 4));
});
});
});
// tslint:disable:max-file-line-count
// tslint:enable:no-unnecessary-type-assertion