aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemco Bloemen <remco@wicked.ventures>2018-08-24 06:18:45 +0800
committerRemco Bloemen <remco@wicked.ventures>2018-08-25 05:09:51 +0800
commit0fb7617a785b765415cb7f43448c9b8ea905963f (patch)
treedbadd0ebf1add5a4caaaccf1bb2fbd4115cc975d
parent4219af1430f1cfc105d3521616941b7947fde4e3 (diff)
downloaddexon-sol-tools-0fb7617a785b765415cb7f43448c9b8ea905963f.tar
dexon-sol-tools-0fb7617a785b765415cb7f43448c9b8ea905963f.tar.gz
dexon-sol-tools-0fb7617a785b765415cb7f43448c9b8ea905963f.tar.bz2
dexon-sol-tools-0fb7617a785b765415cb7f43448c9b8ea905963f.tar.lz
dexon-sol-tools-0fb7617a785b765415cb7f43448c9b8ea905963f.tar.xz
dexon-sol-tools-0fb7617a785b765415cb7f43448c9b8ea905963f.tar.zst
dexon-sol-tools-0fb7617a785b765415cb7f43448c9b8ea905963f.zip
Fix incorect modulus
-rw-r--r--packages/contracts/src/2.0.0/protocol/Exchange/libs/LibMath.sol6
1 files changed, 2 insertions, 4 deletions
diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibMath.sol b/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibMath.sol
index f4e2f1958..1c14dbcae 100644
--- a/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibMath.sol
+++ b/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibMath.sol
@@ -141,10 +141,8 @@ contract LibMath is
return false;
}
uint256 remainder = mulmod(target, numerator, denominator);
- if (remainder == 0) {
- return false;
- }
- remainder = safeSub(denominator, remainder);
+ // TODO: safeMod
+ remainder = safeSub(denominator, remainder) % denominator;
isError = safeMul(1000, remainder) >= safeMul(numerator, target);
return isError;
}