diff options
author | Remco Bloemen <remco@wicked.ventures> | 2018-08-24 06:18:45 +0800 |
---|---|---|
committer | Remco Bloemen <remco@wicked.ventures> | 2018-08-25 05:09:51 +0800 |
commit | 0fb7617a785b765415cb7f43448c9b8ea905963f (patch) | |
tree | dbadd0ebf1add5a4caaaccf1bb2fbd4115cc975d /packages/contracts | |
parent | 4219af1430f1cfc105d3521616941b7947fde4e3 (diff) | |
download | dexon-0x-contracts-0fb7617a785b765415cb7f43448c9b8ea905963f.tar dexon-0x-contracts-0fb7617a785b765415cb7f43448c9b8ea905963f.tar.gz dexon-0x-contracts-0fb7617a785b765415cb7f43448c9b8ea905963f.tar.bz2 dexon-0x-contracts-0fb7617a785b765415cb7f43448c9b8ea905963f.tar.lz dexon-0x-contracts-0fb7617a785b765415cb7f43448c9b8ea905963f.tar.xz dexon-0x-contracts-0fb7617a785b765415cb7f43448c9b8ea905963f.tar.zst dexon-0x-contracts-0fb7617a785b765415cb7f43448c9b8ea905963f.zip |
Fix incorect modulus
Diffstat (limited to 'packages/contracts')
-rw-r--r-- | packages/contracts/src/2.0.0/protocol/Exchange/libs/LibMath.sol | 6 |
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; } |