aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/src
diff options
context:
space:
mode:
authorRemco Bloemen <remco@wicked.ventures>2018-08-24 05:22:59 +0800
committerRemco Bloemen <remco@wicked.ventures>2018-08-25 05:09:51 +0800
commit4219af1430f1cfc105d3521616941b7947fde4e3 (patch)
tree73b7a64c9eb459bc779e556e9c7133aa6c0a7148 /packages/contracts/src
parentc109d1f5451c43afd92dd0fb4bebb48cba65c661 (diff)
downloaddexon-0x-contracts-4219af1430f1cfc105d3521616941b7947fde4e3.tar
dexon-0x-contracts-4219af1430f1cfc105d3521616941b7947fde4e3.tar.gz
dexon-0x-contracts-4219af1430f1cfc105d3521616941b7947fde4e3.tar.bz2
dexon-0x-contracts-4219af1430f1cfc105d3521616941b7947fde4e3.tar.lz
dexon-0x-contracts-4219af1430f1cfc105d3521616941b7947fde4e3.tar.xz
dexon-0x-contracts-4219af1430f1cfc105d3521616941b7947fde4e3.tar.zst
dexon-0x-contracts-4219af1430f1cfc105d3521616941b7947fde4e3.zip
Add DIVISION_BY_ZERO to getPartialAmount for consistency
Diffstat (limited to 'packages/contracts/src')
-rw-r--r--packages/contracts/src/2.0.0/protocol/Exchange/libs/LibMath.sol7
1 files changed, 3 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 d123c55a1..f4e2f1958 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
@@ -39,6 +39,8 @@ contract LibMath is
pure
returns (uint256 partialAmount)
{
+ require(denominator > 0, "DIVISION_BY_ZERO");
+
partialAmount = safeDiv(
safeMul(numerator, target),
denominator
@@ -60,10 +62,7 @@ contract LibMath is
pure
returns (uint256 partialAmount)
{
- require(
- denominator > 0,
- "DIVISION_BY_ZERO"
- );
+ require(denominator > 0, "DIVISION_BY_ZERO");
// safeDiv computes `floor(a / b)`. We use the identity (a, b integer):
// ceil(a / b) = floor((a + b - 1) / b)