diff options
Diffstat (limited to 'packages/contracts/test')
-rw-r--r-- | packages/contracts/test/exchange/transactions.ts | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/packages/contracts/test/exchange/transactions.ts b/packages/contracts/test/exchange/transactions.ts index 7242b0063..fe6df2f75 100644 --- a/packages/contracts/test/exchange/transactions.ts +++ b/packages/contracts/test/exchange/transactions.ts @@ -212,8 +212,12 @@ describe('Exchange transactions', () => { let whitelistOrderFactory: OrderFactory; before(async () => { - const whitelistInstance = await deployer.deployAsync(ContractName.Whitelist, [exchange.address]); - whitelist = new WhitelistContract(whitelistInstance.abi, whitelistInstance.address, provider); + whitelist = await WhitelistContract.deployFrom0xArtifactAsync( + artifacts.Whitelist, + provider, + txDefaults, + exchange.address, + ); const defaultOrderParams = { ...constants.STATIC_ORDER_PARAMS, senderAddress: whitelist.address, @@ -231,7 +235,28 @@ describe('Exchange transactions', () => { erc20Balances = await erc20Wrapper.getBalancesAsync(); }); + it('should revert if maker has not been whitelisted', async () => { + const isApproved = true; + await whitelist.updateWhitelistStatus.sendTransactionAsync(takerAddress, isApproved, { from: owner }); + + const orderStruct = orderUtils.getOrderStruct(signedOrder); + const takerAssetFillAmount = signedOrder.takerAssetAmount; + const salt = ZeroEx.generatePseudoRandomSalt(); + return expect( + whitelist.fillOrderIfWhitelisted.sendTransactionAsync( + orderStruct, + takerAssetFillAmount, + salt, + signedOrder.signature, + { from: takerAddress }, + ), + ).to.be.rejectedWith(constants.REVERT); + }); + it('should revert if taker has not been whitelisted', async () => { + const isApproved = true; + await whitelist.updateWhitelistStatus.sendTransactionAsync(makerAddress, isApproved, { from: owner }); + const orderStruct = orderUtils.getOrderStruct(signedOrder); const takerAssetFillAmount = signedOrder.takerAssetAmount; const salt = ZeroEx.generatePseudoRandomSalt(); @@ -246,8 +271,9 @@ describe('Exchange transactions', () => { ).to.be.rejectedWith(constants.REVERT); }); - it('should fill the order if taker has been whitelisted', async () => { + it('should fill the order if maker and taker have been whitelisted', async () => { const isApproved = true; + await whitelist.updateWhitelistStatus.sendTransactionAsync(makerAddress, isApproved, { from: owner }); await whitelist.updateWhitelistStatus.sendTransactionAsync(takerAddress, isApproved, { from: owner }); const orderStruct = orderUtils.getOrderStruct(signedOrder); @@ -260,7 +286,6 @@ describe('Exchange transactions', () => { signedOrder.signature, { from: takerAddress }, ); - const newBalances = await erc20Wrapper.getBalancesAsync(); const makerAssetFillAmount = signedOrder.makerAssetAmount; |