Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

Commit

Permalink
@0x/contracts-exchange: Update settlement test simulators to match …
Browse files Browse the repository at this point in the history
…settlement optimizations in the Exchange.
  • Loading branch information
dorothy-zbornak committed May 30, 2019
1 parent 4f03b55 commit f4bcb67
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
4 changes: 2 additions & 2 deletions contracts/exchange/test/utils/fill_order_simulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class FillOrderSimulator {
TransferType.Trade,
);
// Maker fee -> fee recipient
if (makerFeePaid.isGreaterThan(0)) {
if (order.makerAddress !== order.feeRecipientAddress) {
await this._transferSimulator.transferFromAsync(
order.makerFeeAssetData,
order.makerAddress,
Expand All @@ -101,7 +101,7 @@ export class FillOrderSimulator {
TransferType.Trade,
);
// Taker fee -> fee recipient
if (takerFeePaid.isGreaterThan(0)) {
if (takerAddress !== order.feeRecipientAddress) {
await this._transferSimulator.transferFromAsync(
order.takerFeeAssetData,
takerAddress,
Expand Down
36 changes: 20 additions & 16 deletions contracts/exchange/test/utils/match_order_tester.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,14 +267,16 @@ function simulateMatchOrders(
orders.rightOrder.makerAssetData,
matchResults,
);
// Left maker fees
transferAsset(
orders.leftOrder.makerAddress,
orders.leftOrder.feeRecipientAddress,
transferAmounts.leftMakerFeeAssetPaidByLeftMakerAmount,
orders.leftOrder.makerFeeAssetData,
matchResults,
);
if (orders.leftOrder.makerAddress !== orders.leftOrder.feeRecipientAddress) {
// Left maker fees
transferAsset(
orders.leftOrder.makerAddress,
orders.leftOrder.feeRecipientAddress,
transferAmounts.leftMakerFeeAssetPaidByLeftMakerAmount,
orders.leftOrder.makerFeeAssetData,
matchResults,
);
}
// Left maker asset -> right maker
transferAsset(
orders.leftOrder.makerAddress,
Expand All @@ -283,14 +285,16 @@ function simulateMatchOrders(
orders.leftOrder.makerAssetData,
matchResults,
);
// Right maker fees
transferAsset(
orders.rightOrder.makerAddress,
orders.rightOrder.feeRecipientAddress,
transferAmounts.rightMakerFeeAssetPaidByRightMakerAmount,
orders.rightOrder.makerFeeAssetData,
matchResults,
);
if (orders.rightOrder.makerAddress !== orders.rightOrder.feeRecipientAddress) {
// Right maker fees
transferAsset(
orders.rightOrder.makerAddress,
orders.rightOrder.feeRecipientAddress,
transferAmounts.rightMakerFeeAssetPaidByRightMakerAmount,
orders.rightOrder.makerFeeAssetData,
matchResults,
);
}
// Left taker profit
transferAsset(
orders.leftOrder.makerAddress,
Expand Down

0 comments on commit f4bcb67

Please sign in to comment.