aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts
diff options
context:
space:
mode:
authorAmir Bandeali <abandeali1@gmail.com>2018-08-29 04:25:05 +0800
committerAmir Bandeali <abandeali1@gmail.com>2018-08-29 04:25:05 +0800
commitf225f9e7c8f59a0ea04f6c9b07493a0458c4f502 (patch)
treeed994e001182e7109723af7c94ec99b6ff20bca8 /packages/contracts
parent14fdb71a716cb95bc1f6933db9057d23f3c41909 (diff)
downloaddexon-sol-tools-f225f9e7c8f59a0ea04f6c9b07493a0458c4f502.tar
dexon-sol-tools-f225f9e7c8f59a0ea04f6c9b07493a0458c4f502.tar.gz
dexon-sol-tools-f225f9e7c8f59a0ea04f6c9b07493a0458c4f502.tar.bz2
dexon-sol-tools-f225f9e7c8f59a0ea04f6c9b07493a0458c4f502.tar.lz
dexon-sol-tools-f225f9e7c8f59a0ea04f6c9b07493a0458c4f502.tar.xz
dexon-sol-tools-f225f9e7c8f59a0ea04f6c9b07493a0458c4f502.tar.zst
dexon-sol-tools-f225f9e7c8f59a0ea04f6c9b07493a0458c4f502.zip
Making rounding consistent in calculateFillResults
Diffstat (limited to 'packages/contracts')
-rw-r--r--packages/contracts/src/2.0.0/protocol/Exchange/MixinExchangeCore.sol4
-rw-r--r--packages/contracts/test/exchange/internal.ts17
2 files changed, 12 insertions, 9 deletions
diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/MixinExchangeCore.sol b/packages/contracts/src/2.0.0/protocol/Exchange/MixinExchangeCore.sol
index 64b1f7665..ff908917d 100644
--- a/packages/contracts/src/2.0.0/protocol/Exchange/MixinExchangeCore.sol
+++ b/packages/contracts/src/2.0.0/protocol/Exchange/MixinExchangeCore.sol
@@ -459,8 +459,8 @@ contract MixinExchangeCore is
order.makerAssetAmount
);
fillResults.makerFeePaid = safeGetPartialAmountFloor(
- takerAssetFilledAmount,
- order.takerAssetAmount,
+ fillResults.makerAssetFilledAmount,
+ order.makerAssetAmount,
order.makerFee
);
fillResults.takerFeePaid = safeGetPartialAmountFloor(
diff --git a/packages/contracts/test/exchange/internal.ts b/packages/contracts/test/exchange/internal.ts
index c5d2fc58f..dc2c5fbe0 100644
--- a/packages/contracts/test/exchange/internal.ts
+++ b/packages/contracts/test/exchange/internal.ts
@@ -221,16 +221,19 @@ describe('Exchange core internal functions', () => {
// in any mathematical operation in either the reference TypeScript
// implementation or the Solidity implementation of
// calculateFillResults.
+ const makerAssetFilledAmount = await referenceSafeGetPartialAmountFloorAsync(
+ takerAssetFilledAmount,
+ orderTakerAssetAmount,
+ otherAmount,
+ );
+ const order = makeOrder(otherAmount, orderTakerAssetAmount, otherAmount, otherAmount);
+ const orderMakerAssetAmount = order.makerAssetAmount;
return {
- makerAssetFilledAmount: await referenceSafeGetPartialAmountFloorAsync(
- takerAssetFilledAmount,
- orderTakerAssetAmount,
- otherAmount,
- ),
+ makerAssetFilledAmount,
takerAssetFilledAmount,
makerFeePaid: await referenceSafeGetPartialAmountFloorAsync(
- takerAssetFilledAmount,
- orderTakerAssetAmount,
+ makerAssetFilledAmount,
+ orderMakerAssetAmount,
otherAmount,
),
takerFeePaid: await referenceSafeGetPartialAmountFloorAsync(