aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorGreg Hysen <greg.hysen@gmail.com>2018-08-21 04:22:21 +0800
committerGreg Hysen <greg.hysen@gmail.com>2018-08-25 09:17:26 +0800
commit057891b342cf639b493adcf0a136f7ee421aaaf9 (patch)
treea646a3e030009910d2fba4114dc60ffa2a336099 /packages
parent407f63ef2055e8cd01af010a2e6d3a6c548c9793 (diff)
downloaddexon-sol-tools-057891b342cf639b493adcf0a136f7ee421aaaf9.tar
dexon-sol-tools-057891b342cf639b493adcf0a136f7ee421aaaf9.tar.gz
dexon-sol-tools-057891b342cf639b493adcf0a136f7ee421aaaf9.tar.bz2
dexon-sol-tools-057891b342cf639b493adcf0a136f7ee421aaaf9.tar.lz
dexon-sol-tools-057891b342cf639b493adcf0a136f7ee421aaaf9.tar.xz
dexon-sol-tools-057891b342cf639b493adcf0a136f7ee421aaaf9.tar.zst
dexon-sol-tools-057891b342cf639b493adcf0a136f7ee421aaaf9.zip
Added fees to matchOrders (previously in calculateFillResults
Diffstat (limited to 'packages')
-rw-r--r--packages/contracts/src/2.0.0/protocol/Exchange/MixinMatchOrders.sol24
1 files changed, 24 insertions, 0 deletions
diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/MixinMatchOrders.sol b/packages/contracts/src/2.0.0/protocol/Exchange/MixinMatchOrders.sol
index 2012aa6db..58f131819 100644
--- a/packages/contracts/src/2.0.0/protocol/Exchange/MixinMatchOrders.sol
+++ b/packages/contracts/src/2.0.0/protocol/Exchange/MixinMatchOrders.sol
@@ -212,6 +212,30 @@ contract MixinMatchOrders is
matchedFillResults.right.takerAssetFilledAmount
);
+ // Compute fees for left order
+ matchedFillResults.left.makerFeePaid = getPartialAmount(
+ matchedFillResults.left.takerAssetFilledAmount,
+ leftOrder.takerAssetAmount,
+ leftOrder.makerFee
+ );
+ matchedFillResults.left.takerFeePaid = getPartialAmount(
+ matchedFillResults.left.takerAssetFilledAmount,
+ leftOrder.takerAssetAmount,
+ leftOrder.takerFee
+ );
+
+ // Compute fees for right order
+ matchedFillResults.right.makerFeePaid = getPartialAmount(
+ matchedFillResults.right.takerAssetFilledAmount,
+ rightOrder.takerAssetAmount,
+ rightOrder.makerFee
+ );
+ matchedFillResults.right.takerFeePaid = getPartialAmount(
+ matchedFillResults.right.takerAssetFilledAmount,
+ rightOrder.takerAssetAmount,
+ rightOrder.takerFee
+ );
+
// Return fill results
return matchedFillResults;
}