diff options
author | Jacob Evans <jacob@dekz.net> | 2018-11-21 13:14:59 +0800 |
---|---|---|
committer | Jacob Evans <jacob@dekz.net> | 2018-12-04 06:13:58 +0800 |
commit | 7934d77defe6510081090398ea352f5ac3d4e3df (patch) | |
tree | 07d9f79fcccac59b2b378966cd814f4a6e79659f /packages | |
parent | cb8601676d70ba648683f8c7df1eca25d670d663 (diff) | |
download | dexon-sol-tools-7934d77defe6510081090398ea352f5ac3d4e3df.tar.gz dexon-sol-tools-7934d77defe6510081090398ea352f5ac3d4e3df.tar.zst dexon-sol-tools-7934d77defe6510081090398ea352f5ac3d4e3df.zip |
chore: taker address and zrx fee test
Diffstat (limited to 'packages')
-rw-r--r-- | packages/contracts/test/extensions/dutch_auction.ts | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/packages/contracts/test/extensions/dutch_auction.ts b/packages/contracts/test/extensions/dutch_auction.ts index 4ad5cfa19..dbd956c0f 100644 --- a/packages/contracts/test/extensions/dutch_auction.ts +++ b/packages/contracts/test/extensions/dutch_auction.ts @@ -175,7 +175,8 @@ describe.only(ContractName.DutchAuction, () => { exchangeAddress: exchangeInstance.address, makerAddress, feeRecipientAddress, - senderAddress: dutchAuctionContract.address, + // taker address or sender address should be set to the ducth auction contract + takerAddress: dutchAuctionContract.address, makerAssetData: extendMakerAssetData( assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress), auctionBeginTimeSeconds, @@ -288,6 +289,50 @@ describe.only(ContractName.DutchAuction, () => { erc20Balances[makerAddress][wethContract.address].plus(currentAmount), ); }); + it('maker fees on sellOrder are paid to the fee receipient', async () => { + sellOrder = await sellerOrderFactory.newSignedOrderAsync({ + makerFee: new BigNumber(1), + }); + const txHash = await dutchAuctionContract.matchOrders.sendTransactionAsync( + buyOrder, + sellOrder, + buyOrder.signature, + sellOrder.signature, + { + from: takerAddress, + }, + ); + await web3Wrapper.awaitTransactionSuccessAsync(txHash); + const newBalances = await erc20Wrapper.getBalancesAsync(); + expect(newBalances[makerAddress][wethContract.address]).to.be.bignumber.equal( + erc20Balances[makerAddress][wethContract.address].plus(buyOrder.makerAssetAmount), + ); + expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal( + erc20Balances[feeRecipientAddress][zrxToken.address].plus(sellOrder.makerFee), + ); + }); + it('maker fees on buyOrder are paid to the fee receipient', async () => { + buyOrder = await buyerOrderFactory.newSignedOrderAsync({ + makerFee: new BigNumber(1), + }); + const txHash = await dutchAuctionContract.matchOrders.sendTransactionAsync( + buyOrder, + sellOrder, + buyOrder.signature, + sellOrder.signature, + { + from: takerAddress, + }, + ); + await web3Wrapper.awaitTransactionSuccessAsync(txHash); + const newBalances = await erc20Wrapper.getBalancesAsync(); + expect(newBalances[makerAddress][wethContract.address]).to.be.bignumber.equal( + erc20Balances[makerAddress][wethContract.address].plus(buyOrder.makerAssetAmount), + ); + expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal( + erc20Balances[feeRecipientAddress][zrxToken.address].plus(buyOrder.makerFee), + ); + }); it('should revert when auction expires', async () => { auctionEndTimeSeconds = new BigNumber(currentBlockTimestamp - 100); sellOrder = await sellerOrderFactory.newSignedOrderAsync({ |