Use same taker numerator/denominator for all math in calculateFillResults

This commit is contained in:
Amir Bandeali
2019-09-02 23:34:43 -07:00
parent 73144fa4d5
commit 75a8b1c081
3 changed files with 4 additions and 21 deletions

View File

@@ -74,8 +74,8 @@ library LibFillResults {
order.makerAssetAmount
);
fillResults.makerFeePaid = LibMath.safeGetPartialAmountFloor(
fillResults.makerAssetFilledAmount,
order.makerAssetAmount,
takerAssetFilledAmount,
order.takerAssetAmount,
order.makerFee
);
fillResults.takerFeePaid = LibMath.safeGetPartialAmountFloor(

View File

@@ -225,23 +225,6 @@ blockchainTests('LibFillResults', env => {
).to.revertWith(expectedError);
});
it('reverts if `order.makerAssetAmount` is 0', async () => {
const order = makeOrder({
makerAssetAmount: constants.ZERO_AMOUNT,
takerAssetAmount: ONE_ETHER,
});
const takerAssetFilledAmount = ONE_ETHER;
const expectedError = new LibMathRevertErrors.DivisionByZeroError();
return expect(
libsContract.calculateFillResults.callAsync(
order,
takerAssetFilledAmount,
DEFAULT_PROTOCOL_FEE_MULTIPLIER,
DEFAULT_GAS_PRICE,
),
).to.revertWith(expectedError);
});
it('reverts if `order.takerAssetAmount` is 0', async () => {
const order = makeOrder({
makerAssetAmount: ONE_ETHER,