aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Hysen <greg.hysen@gmail.com>2018-12-08 06:21:29 +0800
committerGreg Hysen <greg.hysen@gmail.com>2018-12-19 05:36:05 +0800
commit7af2c751dceb52adc84ded417b260666e6a96c29 (patch)
tree06d3a321c9f82dc1db24957d7bd74c28bb80d7fa
parentd882133e444d034c62b5f88c988d4cdd3fb2dbf4 (diff)
downloaddexon-sol-tools-7af2c751dceb52adc84ded417b260666e6a96c29.tar
dexon-sol-tools-7af2c751dceb52adc84ded417b260666e6a96c29.tar.gz
dexon-sol-tools-7af2c751dceb52adc84ded417b260666e6a96c29.tar.bz2
dexon-sol-tools-7af2c751dceb52adc84ded417b260666e6a96c29.tar.lz
dexon-sol-tools-7af2c751dceb52adc84ded417b260666e6a96c29.tar.xz
dexon-sol-tools-7af2c751dceb52adc84ded417b260666e6a96c29.tar.zst
dexon-sol-tools-7af2c751dceb52adc84ded417b260666e6a96c29.zip
fillOrder tests with new wrapper
-rw-r--r--packages/contracts/test/extensions/balance_threshold_filter.ts37
1 files changed, 13 insertions, 24 deletions
diff --git a/packages/contracts/test/extensions/balance_threshold_filter.ts b/packages/contracts/test/extensions/balance_threshold_filter.ts
index 9b48cdf93..cfa1dcbdf 100644
--- a/packages/contracts/test/extensions/balance_threshold_filter.ts
+++ b/packages/contracts/test/extensions/balance_threshold_filter.ts
@@ -60,11 +60,11 @@ describe.only(ContractName.BalanceThresholdFilter, () => {
let erc20Wrapper: ERC20Wrapper;
let erc20Balances: ERC20BalancesByOwner;
let balanceThresholdWrapper: BalanceThresholdWrapper;
+ let nonCompliantBalanceThresholdWrapper: BalanceThresholdWrapper;
let takerTransactionFactory: TransactionFactory;
let compliantSignedOrder: SignedOrder;
let compliantSignedFillOrderTx: SignedTransaction;
- let noncompliantSignedFillOrderTx: SignedTransaction;
let logDecoder: LogDecoder;
@@ -237,6 +237,8 @@ describe.only(ContractName.BalanceThresholdFilter, () => {
throw new Error(`w`);*/
logDecoder = new LogDecoder(web3Wrapper);
balanceThresholdWrapper = new BalanceThresholdWrapper(compliantForwarderInstance, exchangeInstance, new TransactionFactory(takerPrivateKey, exchangeInstance.address), provider);
+ const nonCompliantPrivateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(nonCompliantAddress)];
+ nonCompliantBalanceThresholdWrapper = new BalanceThresholdWrapper(compliantForwarderInstance, exchangeInstance, new TransactionFactory(nonCompliantPrivateKey, exchangeInstance.address), provider);
});
beforeEach(async () => {
await blockchainLifecycle.startAsync();
@@ -334,7 +336,7 @@ describe.only(ContractName.BalanceThresholdFilter, () => {
});
it('should transfer the correct amounts and validate both maker/taker when both maker and taker meet the balance threshold', async () => {
// Execute a valid fill
- const txReceipt = await balanceThresholdWrapper.fillOrderAsync(compliantSignedOrder, compliantSignedFillOrderTx.signerAddress, {takerAssetFillAmount});
+ const txReceipt = await balanceThresholdWrapper.fillOrderAsync(compliantSignedOrder, compliantTakerAddress, {takerAssetFillAmount});
// Assert validated addresses
const expectedValidatedAddresseses = [compliantSignedOrder.makerAddress, compliantSignedFillOrderTx.signerAddress];
assertValidatedAddressesLog(txReceipt, expectedValidatedAddresseses);
@@ -377,35 +379,22 @@ describe.only(ContractName.BalanceThresholdFilter, () => {
senderAddress: compliantForwarderInstance.address,
makerAddress: nonCompliantAddress
});
- const signedOrderWithoutExchangeAddress = orderUtils.getOrderWithoutExchangeAddress(
- signedOrderWithBadMakerAddress,
- );
- const signedOrderWithoutExchangeAddressData = exchangeInstance.fillOrder.getABIEncodedTransactionData(
- signedOrderWithoutExchangeAddress,
- takerAssetFillAmount,
- compliantSignedOrder.signature,
- );
- const signedFillOrderTx = takerTransactionFactory.newSignedTransaction(
- signedOrderWithoutExchangeAddressData,
- );
- // Call compliant forwarder
+ // Execute transaction
return expectTransactionFailedAsync(
- compliantForwarderInstance.executeTransaction.sendTransactionAsync(
- signedFillOrderTx.salt,
- signedFillOrderTx.signerAddress,
- signedFillOrderTx.data,
- signedFillOrderTx.signature,
+ balanceThresholdWrapper.fillOrderAsync(
+ signedOrderWithBadMakerAddress,
+ compliantTakerAddress,
+ {takerAssetFillAmount}
),
RevertReason.AtLeastOneAddressDoesNotMeetBalanceThreshold
);
});
it('should revert if taker does not meet the balance threshold', async () => {
return expectTransactionFailedAsync(
- compliantForwarderInstance.executeTransaction.sendTransactionAsync(
- compliantSignedFillOrderTx.salt,
- nonCompliantAddress,
- compliantSignedFillOrderTx.data,
- compliantSignedFillOrderTx.signature,
+ nonCompliantBalanceThresholdWrapper.fillOrderAsync(
+ compliantSignedOrder,
+ nonCompliantAddress,
+ {takerAssetFillAmount}
),
RevertReason.AtLeastOneAddressDoesNotMeetBalanceThreshold
);