aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/contracts/contracts/extensions/BalanceThresholdFilter/MixinBalanceThresholdFilterCore.sol4
-rw-r--r--packages/contracts/test/extensions/balance_threshold_filter.ts44
2 files changed, 45 insertions, 3 deletions
diff --git a/packages/contracts/contracts/extensions/BalanceThresholdFilter/MixinBalanceThresholdFilterCore.sol b/packages/contracts/contracts/extensions/BalanceThresholdFilter/MixinBalanceThresholdFilterCore.sol
index 303e1d9c2..0ad8ccddf 100644
--- a/packages/contracts/contracts/extensions/BalanceThresholdFilter/MixinBalanceThresholdFilterCore.sol
+++ b/packages/contracts/contracts/extensions/BalanceThresholdFilter/MixinBalanceThresholdFilterCore.sol
@@ -258,7 +258,7 @@ contract MixinBalanceThresholdFilterCore is MBalanceThresholdFilterCore {
// This is to avoid corruption when making calls in the loop below.
let freeMemPtr := addressesToValidateElementEndPtr
mstore(0x40, freeMemPtr)
-/*
+
// Validate addresses
let thresholdAssetAddress := sload(THRESHOLD_ASSET_slot)
let thresholdBalance := sload(THRESHOLD_BALANCE_slot)
@@ -307,7 +307,7 @@ contract MixinBalanceThresholdFilterCore is MBalanceThresholdFilterCore {
// 64 -- strlen(AT_LEAST_ONE_ADDRESS_DOES_NOT_MEET_BALANCE_THRESHOLD) rounded up to nearest 32-byte word.
revert(0, 132)
}
- }*/
+ }
// Record validated addresses
validatedAddresses := addressesToValidate
diff --git a/packages/contracts/test/extensions/balance_threshold_filter.ts b/packages/contracts/test/extensions/balance_threshold_filter.ts
index 7ca8a8e98..0a03678b1 100644
--- a/packages/contracts/test/extensions/balance_threshold_filter.ts
+++ b/packages/contracts/test/extensions/balance_threshold_filter.ts
@@ -1225,7 +1225,7 @@ describe.only(ContractName.BalanceThresholdFilter, () => {
compliantSignedOrder = await orderFactory.newSignedOrderAsync();
compliantSignedOrder2 = await orderFactory2.newSignedOrderAsync();
});
- it.only('Should transfer correct amounts when both makers and taker meet the balance threshold', async () => {
+ it('Should transfer correct amounts when both makers and taker meet the balance threshold', async () => {
// Test values/results taken from Match Orders test:
// 'Should transfer correct amounts when right order is fully filled and values pass isRoundingErrorFloor but fail isRoundingErrorCeil'
// Create orders to match
@@ -1309,6 +1309,48 @@ describe.only(ContractName.BalanceThresholdFilter, () => {
erc20Balances[feeRecipientAddress][zrxToken.address].add(expectedTransferAmounts.feePaidByLeftMaker).add(expectedTransferAmounts.feePaidByRightMaker).add(expectedTransferAmounts.feePaidByTakerLeft).add(expectedTransferAmounts.feePaidByTakerRight),
);
});
+ it('should revert if left maker does not meet the balance threshold', async () => {
+ // Create signed order with non-compliant maker address
+ const signedOrderWithBadMakerAddress = await orderFactory.newSignedOrderAsync({
+ senderAddress: compliantForwarderInstance.address,
+ makerAddress: nonCompliantAddress
+ });
+ // Execute transaction
+ return expectTransactionFailedAsync(
+ balanceThresholdWrapper.matchOrdersAsync(
+ compliantSignedOrder,
+ signedOrderWithBadMakerAddress,
+ compliantTakerAddress,
+ ),
+ RevertReason.AtLeastOneAddressDoesNotMeetBalanceThreshold
+ );
+ });
+ it('should revert if right maker does not meet the balance threshold', async () => {
+ // Create signed order with non-compliant maker address
+ const signedOrderWithBadMakerAddress = await orderFactory.newSignedOrderAsync({
+ senderAddress: compliantForwarderInstance.address,
+ makerAddress: nonCompliantAddress
+ });
+ // Execute transaction
+ return expectTransactionFailedAsync(
+ balanceThresholdWrapper.matchOrdersAsync(
+ signedOrderWithBadMakerAddress,
+ compliantSignedOrder,
+ compliantTakerAddress,
+ ),
+ RevertReason.AtLeastOneAddressDoesNotMeetBalanceThreshold
+ );
+ });
+ it('should revert if taker does not meet the balance threshold', async () => {
+ return expectTransactionFailedAsync(
+ nonCompliantBalanceThresholdWrapper.matchOrdersAsync(
+ compliantSignedOrder,
+ compliantSignedOrder,
+ nonCompliantAddress,
+ ),
+ RevertReason.AtLeastOneAddressDoesNotMeetBalanceThreshold
+ );
+ });
});
describe('cancelOrder', () => {