Use same taker numerator/denominator for all math in calculateFillResults
This commit is contained in:
parent
73144fa4d5
commit
75a8b1c081
@ -74,8 +74,8 @@ library LibFillResults {
|
|||||||
order.makerAssetAmount
|
order.makerAssetAmount
|
||||||
);
|
);
|
||||||
fillResults.makerFeePaid = LibMath.safeGetPartialAmountFloor(
|
fillResults.makerFeePaid = LibMath.safeGetPartialAmountFloor(
|
||||||
fillResults.makerAssetFilledAmount,
|
takerAssetFilledAmount,
|
||||||
order.makerAssetAmount,
|
order.takerAssetAmount,
|
||||||
order.makerFee
|
order.makerFee
|
||||||
);
|
);
|
||||||
fillResults.takerFeePaid = LibMath.safeGetPartialAmountFloor(
|
fillResults.takerFeePaid = LibMath.safeGetPartialAmountFloor(
|
||||||
|
@ -225,23 +225,6 @@ blockchainTests('LibFillResults', env => {
|
|||||||
).to.revertWith(expectedError);
|
).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 () => {
|
it('reverts if `order.takerAssetAmount` is 0', async () => {
|
||||||
const order = makeOrder({
|
const order = makeOrder({
|
||||||
makerAssetAmount: ONE_ETHER,
|
makerAssetAmount: ONE_ETHER,
|
||||||
|
@ -427,8 +427,8 @@ blockchainTests('Isolated fillOrder() tests', env => {
|
|||||||
});
|
});
|
||||||
const takerAssetFillAmount = order.takerAssetAmount.dividedToIntegerBy(3);
|
const takerAssetFillAmount = order.takerAssetAmount.dividedToIntegerBy(3);
|
||||||
const expectedError = new LibMathRevertErrors.RoundingError(
|
const expectedError = new LibMathRevertErrors.RoundingError(
|
||||||
takerAssetFillAmount.times(2),
|
takerAssetFillAmount,
|
||||||
order.makerAssetAmount,
|
order.takerAssetAmount,
|
||||||
order.makerFee,
|
order.makerFee,
|
||||||
);
|
);
|
||||||
return expect(exchange.fillOrderAsync(order, takerAssetFillAmount)).to.revertWith(expectedError);
|
return expect(exchange.fillOrderAsync(order, takerAssetFillAmount)).to.revertWith(expectedError);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user