@0x/contracts-exchange: Update settlement test simulators to match settlement optimizations in the Exchange.

This commit is contained in:
Lawrence Forman 2019-05-29 22:00:39 -04:00 committed by Amir Bandeali
parent 2f464ee8f0
commit 95e7999e45
2 changed files with 22 additions and 18 deletions

View File

@ -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,
@ -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,

View File

@ -267,6 +267,7 @@ function simulateMatchOrders(
orders.rightOrder.makerAssetData,
matchResults,
);
if (orders.leftOrder.makerAddress !== orders.leftOrder.feeRecipientAddress) {
// Left maker fees
transferAsset(
orders.leftOrder.makerAddress,
@ -275,6 +276,7 @@ function simulateMatchOrders(
orders.leftOrder.makerFeeAssetData,
matchResults,
);
}
// Left maker asset -> right maker
transferAsset(
orders.leftOrder.makerAddress,
@ -283,6 +285,7 @@ function simulateMatchOrders(
orders.leftOrder.makerAssetData,
matchResults,
);
if (orders.rightOrder.makerAddress !== orders.rightOrder.feeRecipientAddress) {
// Right maker fees
transferAsset(
orders.rightOrder.makerAddress,
@ -291,6 +294,7 @@ function simulateMatchOrders(
orders.rightOrder.makerFeeAssetData,
matchResults,
);
}
// Left taker profit
transferAsset(
orders.leftOrder.makerAddress,