diff --git a/.gitmodules b/.gitmodules
index e124719..e69de29 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +0,0 @@
-[submodule "lib/ds-test"]
- path = lib/ds-test
- url = https://github.com/dapphub/ds-test
diff --git a/Makefile b/Makefile
deleted file mode 100644
index c5697bb..0000000
--- a/Makefile
+++ /dev/null
@@ -1,2 +0,0 @@
-all:; dapp build
-test:; dapp test
diff --git a/contracts/DSMath.sol b/contracts/DSMath.sol
new file mode 100644
index 0000000..5a02943
--- /dev/null
+++ b/contracts/DSMath.sol
@@ -0,0 +1,74 @@
+/// math.sol -- mixin for inline numerical wizardry
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+
+pragma solidity 0.4.24;
+
+import "./DSMathL.sol";
+
+contract DSMath {
+ using DSMathL for uint;
+ using DSMathL for int;
+
+ uint constant WAD = 10 ** 18;
+ uint constant RAY = 10 ** 27;
+
+ function add(uint x, uint y) public pure returns (uint z) {
+ return x.ds_add(y);
+ }
+
+ function sub(uint x, uint y) public pure returns (uint z) {
+ return x.ds_sub(y);
+ }
+
+ function mul(uint x, uint y) public pure returns (uint z) {
+ return x.ds_mul(y);
+ }
+
+ function min(uint x, uint y) public pure returns (uint z) {
+ return x.ds_min(y);
+ }
+
+ function max(uint x, uint y) public pure returns (uint z) {
+ return x.ds_max(y);
+ }
+
+ function imin(int x, int y) public pure returns (int z) {
+ return x.ds_imin(y);
+ }
+
+ function imax(int x, int y) public pure returns (int z) {
+ return x.ds_imax(y);
+ }
+
+ function wmul(uint x, uint y) public pure returns (uint) {
+ return x.ds_wmul(y);
+ }
+
+ function rmul(uint x, uint y) public pure returns (uint) {
+ return x.ds_rmul(y);
+ }
+
+ function wdiv(uint x, uint y) public pure returns (uint) {
+ return x.ds_wdiv(y);
+ }
+
+ function rdiv(uint x, uint y) public pure returns (uint) {
+ return x.ds_rdiv(y);
+ }
+
+ function rpow(uint x, uint n) public pure returns (uint) {
+ return x.ds_rpow(n);
+ }
+}
diff --git a/src/math.sol b/contracts/DSMathL.sol
similarity index 63%
rename from src/math.sol
rename to contracts/DSMathL.sol
index 0d12e17..8fd31c6 100644
--- a/src/math.sol
+++ b/contracts/DSMathL.sol
@@ -13,46 +13,46 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-pragma solidity >0.4.13;
+pragma solidity 0.4.24;
-contract DSMath {
- function add(uint x, uint y) internal pure returns (uint z) {
+library DSMathL {
+ function ds_add(uint x, uint y) public pure returns (uint z) {
require((z = x + y) >= x, "ds-math-add-overflow");
}
- function sub(uint x, uint y) internal pure returns (uint z) {
+ function ds_sub(uint x, uint y) public pure returns (uint z) {
require((z = x - y) <= x, "ds-math-sub-underflow");
}
- function mul(uint x, uint y) internal pure returns (uint z) {
+ function ds_mul(uint x, uint y) public pure returns (uint z) {
require(y == 0 || (z = x * y) / y == x, "ds-math-mul-overflow");
}
- function min(uint x, uint y) internal pure returns (uint z) {
+ function ds_min(uint x, uint y) public pure returns (uint z) {
return x <= y ? x : y;
}
- function max(uint x, uint y) internal pure returns (uint z) {
+ function ds_max(uint x, uint y) public pure returns (uint z) {
return x >= y ? x : y;
}
- function imin(int x, int y) internal pure returns (int z) {
+ function ds_imin(int x, int y) public pure returns (int z) {
return x <= y ? x : y;
}
- function imax(int x, int y) internal pure returns (int z) {
+ function ds_imax(int x, int y) public pure returns (int z) {
return x >= y ? x : y;
}
uint constant WAD = 10 ** 18;
uint constant RAY = 10 ** 27;
- function wmul(uint x, uint y) internal pure returns (uint z) {
- z = add(mul(x, y), WAD / 2) / WAD;
+ function ds_wmul(uint x, uint y) public pure returns (uint z) {
+ z = ds_add(ds_mul(x, y), WAD / 2) / WAD;
}
- function rmul(uint x, uint y) internal pure returns (uint z) {
- z = add(mul(x, y), RAY / 2) / RAY;
+ function ds_rmul(uint x, uint y) public pure returns (uint z) {
+ z = ds_add(ds_mul(x, y), RAY / 2) / RAY;
}
- function wdiv(uint x, uint y) internal pure returns (uint z) {
- z = add(mul(x, WAD), y / 2) / y;
+ function ds_wdiv(uint x, uint y) public pure returns (uint z) {
+ z = ds_add(ds_mul(x, WAD), y / 2) / y;
}
- function rdiv(uint x, uint y) internal pure returns (uint z) {
- z = add(mul(x, RAY), y / 2) / y;
+ function ds_rdiv(uint x, uint y) public pure returns (uint z) {
+ z = ds_add(ds_mul(x, RAY), y / 2) / y;
}
// This famous algorithm is called "exponentiation by squaring"
@@ -70,14 +70,14 @@ contract DSMath {
// Also, EVM division is flooring and
// floor[(n-1) / 2] = floor[n / 2].
//
- function rpow(uint x, uint n) internal pure returns (uint z) {
+ function ds_rpow(uint x, uint n) public pure returns (uint z) {
z = n % 2 != 0 ? x : RAY;
for (n /= 2; n != 0; n /= 2) {
- x = rmul(x, x);
+ x = ds_rmul(x, x);
if (n % 2 != 0) {
- z = rmul(z, x);
+ z = ds_rmul(z, x);
}
}
}
diff --git a/contracts/Migrations.sol b/contracts/Migrations.sol
new file mode 100644
index 0000000..69c127d
--- /dev/null
+++ b/contracts/Migrations.sol
@@ -0,0 +1,23 @@
+pragma solidity 0.4.24;
+
+contract Migrations {
+ address public owner;
+ uint public last_completed_migration;
+
+ constructor() public {
+ owner = msg.sender;
+ }
+
+ modifier restricted() {
+ if (msg.sender == owner) _;
+ }
+
+ function setCompleted(uint completed) public restricted {
+ last_completed_migration = completed;
+ }
+
+ function upgrade(address new_address) public restricted {
+ Migrations upgraded = Migrations(new_address);
+ upgraded.setCompleted(last_completed_migration);
+ }
+}
diff --git a/src/math.t.sol b/contracts/ds-test/DSMathTest.t.sol
similarity index 97%
rename from src/math.t.sol
rename to contracts/ds-test/DSMathTest.t.sol
index 3baca60..4c00968 100644
--- a/src/math.t.sol
+++ b/contracts/ds-test/DSMathTest.t.sol
@@ -11,10 +11,10 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-pragma solidity >0.4.13;
+pragma solidity 0.4.24;
-import "ds-test/test.sol";
-import "./math.sol";
+import "./DSTest.sol";
+import "../DSMath.sol";
contract DSMathTest is DSTest, DSMath {
function testFail_add() public pure {
diff --git a/contracts/ds-test/DSTest.sol b/contracts/ds-test/DSTest.sol
new file mode 100644
index 0000000..e3b7997
--- /dev/null
+++ b/contracts/ds-test/DSTest.sol
@@ -0,0 +1,139 @@
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+
+pragma solidity 0.4.24;
+
+contract DSTest {
+ event eventListener (address target, bool exact);
+ event logs (bytes);
+ event log_bytes32 (bytes32);
+ event log_named_address (bytes32 key, address val);
+ event log_named_bytes32 (bytes32 key, bytes32 val);
+ event log_named_decimal_int (bytes32 key, int val, uint decimals);
+ event log_named_decimal_uint (bytes32 key, uint val, uint decimals);
+ event log_named_int (bytes32 key, int val);
+ event log_named_uint (bytes32 key, uint val);
+
+ bool public IS_TEST;
+ bool public failed;
+ bool SUPPRESS_SETUP_WARNING; // hack for solc pure restriction warning
+
+ constructor() internal {
+ IS_TEST = true;
+ }
+
+ function setUp() public {
+ SUPPRESS_SETUP_WARNING = true; // totally unused by anything
+ }
+
+ function fail() internal {
+ failed = true;
+ }
+
+ function expectEventsExact(address target) internal {
+ emit eventListener(target, true);
+ }
+
+ modifier logs_gas() {
+ uint startGas = gasleft();
+ _;
+ uint endGas = gasleft();
+ emit log_named_uint("gas", startGas - endGas);
+ }
+
+ function assertTrue(bool condition) internal {
+ if (!condition) {
+ emit log_bytes32("Assertion failed");
+ fail();
+ }
+ }
+
+ function assertEq(address a, address b) internal {
+ if (a != b) {
+ emit log_bytes32("Error: Wrong `address' value");
+ emit log_named_address(" Expected", b);
+ emit log_named_address(" Actual", a);
+ fail();
+ }
+ }
+
+ function assertEq32(bytes32 a, bytes32 b) internal {
+ assertEq(a, b);
+ }
+
+ function assertEq(bytes32 a, bytes32 b) internal {
+ if (a != b) {
+ emit log_bytes32("Error: Wrong `bytes32' value");
+ emit log_named_bytes32(" Expected", b);
+ emit log_named_bytes32(" Actual", a);
+ fail();
+ }
+ }
+
+ function assertEqDecimal(int a, int b, uint decimals) internal {
+ if (a != b) {
+ emit log_bytes32("Error: Wrong fixed-point decimal");
+ emit log_named_decimal_int(" Expected", b, decimals);
+ emit log_named_decimal_int(" Actual", a, decimals);
+ fail();
+ }
+ }
+
+ function assertEqDecimal(uint a, uint b, uint decimals) internal {
+ if (a != b) {
+ emit log_bytes32("Error: Wrong fixed-point decimal");
+ emit log_named_decimal_uint(" Expected", b, decimals);
+ emit log_named_decimal_uint(" Actual", a, decimals);
+ fail();
+ }
+ }
+
+ function assertEq(int a, int b) internal {
+ if (a != b) {
+ emit log_bytes32("Error: Wrong `int' value");
+ emit log_named_int(" Expected", b);
+ emit log_named_int(" Actual", a);
+ fail();
+ }
+ }
+
+ function assertEq(uint a, uint b) internal {
+ if (a != b) {
+ emit log_bytes32("Error: Wrong `uint' value");
+ emit log_named_uint(" Expected", b);
+ emit log_named_uint(" Actual", a);
+ fail();
+ }
+ }
+
+ function assertEq0(bytes memory a, bytes memory b) internal {
+ bool ok = true;
+
+ if (a.length == b.length) {
+ for (uint i = 0; i < a.length; i++) {
+ if (a[i] != b[i]) {
+ ok = false;
+ }
+ }
+ } else {
+ ok = false;
+ }
+
+ if (!ok) {
+ emit log_bytes32("Error: Wrong `bytes' value");
+ emit log_named_bytes32(" Expected", "[cannot show `bytes' value]");
+ emit log_named_bytes32(" Actual", "[cannot show `bytes' value]");
+ fail();
+ }
+ }
+}
\ No newline at end of file
diff --git a/default.nix b/default.nix
deleted file mode 100644
index 6de4023..0000000
--- a/default.nix
+++ /dev/null
@@ -1,5 +0,0 @@
-{ solidityPackage, dappsys }: solidityPackage {
- name = "ds-math";
- deps = with dappsys; [ds-test];
- src = ./src;
-}
diff --git a/lib/ds-test b/lib/ds-test
deleted file mode 160000
index b247145..0000000
--- a/lib/ds-test
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit b24714595775e8ef676493261508cc231e583a83
diff --git a/migrations/1_initial_migration.js b/migrations/1_initial_migration.js
new file mode 100644
index 0000000..2847679
--- /dev/null
+++ b/migrations/1_initial_migration.js
@@ -0,0 +1,7 @@
+var Migrations = artifacts.require("./Migrations.sol");
+
+module.exports = function(deployer) {
+ deployer.then(async () => { //fake async await support: https://github.com/trufflesuite/truffle/issues/501
+ await deployer.deploy(Migrations)
+ })
+};
diff --git a/migrations/2_initial_migration.js b/migrations/2_initial_migration.js
new file mode 100644
index 0000000..8797000
--- /dev/null
+++ b/migrations/2_initial_migration.js
@@ -0,0 +1,14 @@
+var DSMathL = artifacts.require("./DSMathL.sol");
+var DSMath = artifacts.require("./DSMath.sol");
+var DSMathTest = artifacts.require("./DSMathTest.sol");
+
+module.exports = function(deployer) {
+ deployer.then(async () => { //fake async await support: https://github.com/trufflesuite/truffle/issues/501
+ //deploy library
+ await deployer.deploy(DSMathL)
+
+ //link library
+ await deployer.link(DSMathL, DSMath)
+ await deployer.link(DSMathL, DSMathTest)
+ })
+}
diff --git a/package-lock.json b/package-lock.json
new file mode 100644
index 0000000..48da2a3
--- /dev/null
+++ b/package-lock.json
@@ -0,0 +1,725 @@
+{
+ "name": "ds-math",
+ "version": "1.0.0",
+ "lockfileVersion": 1,
+ "requires": true,
+ "dependencies": {
+ "ansi-regex": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
+ "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
+ "dev": true
+ },
+ "assertion-error": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz",
+ "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==",
+ "dev": true
+ },
+ "balanced-match": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
+ "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
+ "dev": true
+ },
+ "brace-expansion": {
+ "version": "1.1.11",
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
+ "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
+ "dev": true,
+ "requires": {
+ "balanced-match": "^1.0.0",
+ "concat-map": "0.0.1"
+ }
+ },
+ "browser-stdout": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz",
+ "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=",
+ "dev": true
+ },
+ "builtin-modules": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz",
+ "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=",
+ "dev": true
+ },
+ "camelcase": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz",
+ "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=",
+ "dev": true
+ },
+ "chai": {
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/chai/-/chai-4.2.0.tgz",
+ "integrity": "sha512-XQU3bhBukrOsQCuwZndwGcCVQHyZi53fQ6Ys1Fym7E4olpIqqZZhhoFJoaKVvV17lWQoXYwgWN2nF5crA8J2jw==",
+ "dev": true,
+ "requires": {
+ "assertion-error": "^1.1.0",
+ "check-error": "^1.0.2",
+ "deep-eql": "^3.0.1",
+ "get-func-name": "^2.0.0",
+ "pathval": "^1.1.0",
+ "type-detect": "^4.0.5"
+ }
+ },
+ "check-error": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz",
+ "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=",
+ "dev": true
+ },
+ "cliui": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz",
+ "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=",
+ "dev": true,
+ "requires": {
+ "string-width": "^1.0.1",
+ "strip-ansi": "^3.0.1",
+ "wrap-ansi": "^2.0.0"
+ }
+ },
+ "code-point-at": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz",
+ "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=",
+ "dev": true
+ },
+ "commander": {
+ "version": "2.11.0",
+ "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz",
+ "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==",
+ "dev": true
+ },
+ "concat-map": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
+ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
+ "dev": true
+ },
+ "debug": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
+ "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
+ "dev": true,
+ "requires": {
+ "ms": "2.0.0"
+ }
+ },
+ "decamelize": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
+ "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=",
+ "dev": true
+ },
+ "deep-eql": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz",
+ "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==",
+ "dev": true,
+ "requires": {
+ "type-detect": "^4.0.0"
+ }
+ },
+ "diff": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/diff/-/diff-3.3.1.tgz",
+ "integrity": "sha512-MKPHZDMB0o6yHyDryUOScqZibp914ksXwAMYMTHj6KO8UeKsRYNJD3oNCKjTqZon+V488P7N/HzXF8t7ZR95ww==",
+ "dev": true
+ },
+ "error-ex": {
+ "version": "1.3.2",
+ "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",
+ "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==",
+ "dev": true,
+ "requires": {
+ "is-arrayish": "^0.2.1"
+ }
+ },
+ "escape-string-regexp": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
+ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
+ "dev": true
+ },
+ "find-up": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz",
+ "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=",
+ "dev": true,
+ "requires": {
+ "path-exists": "^2.0.0",
+ "pinkie-promise": "^2.0.0"
+ }
+ },
+ "fs-extra": {
+ "version": "0.30.0",
+ "resolved": "http://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz",
+ "integrity": "sha1-8jP/zAjU2n1DLapEl3aYnbHfk/A=",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "^4.1.2",
+ "jsonfile": "^2.1.0",
+ "klaw": "^1.0.0",
+ "path-is-absolute": "^1.0.0",
+ "rimraf": "^2.2.8"
+ }
+ },
+ "fs.realpath": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
+ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
+ "dev": true
+ },
+ "get-caller-file": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz",
+ "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==",
+ "dev": true
+ },
+ "get-func-name": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz",
+ "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=",
+ "dev": true
+ },
+ "glob": {
+ "version": "7.1.2",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz",
+ "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==",
+ "dev": true,
+ "requires": {
+ "fs.realpath": "^1.0.0",
+ "inflight": "^1.0.4",
+ "inherits": "2",
+ "minimatch": "^3.0.4",
+ "once": "^1.3.0",
+ "path-is-absolute": "^1.0.0"
+ }
+ },
+ "graceful-fs": {
+ "version": "4.1.15",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz",
+ "integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==",
+ "dev": true
+ },
+ "growl": {
+ "version": "1.10.3",
+ "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.3.tgz",
+ "integrity": "sha512-hKlsbA5Vu3xsh1Cg3J7jSmX/WaW6A5oBeqzM88oNbCRQFz+zUaXm6yxS4RVytp1scBoJzSYl4YAEOQIt6O8V1Q==",
+ "dev": true
+ },
+ "has-flag": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
+ "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=",
+ "dev": true
+ },
+ "he": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz",
+ "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=",
+ "dev": true
+ },
+ "hosted-git-info": {
+ "version": "2.7.1",
+ "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.7.1.tgz",
+ "integrity": "sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==",
+ "dev": true
+ },
+ "inflight": {
+ "version": "1.0.6",
+ "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
+ "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
+ "dev": true,
+ "requires": {
+ "once": "^1.3.0",
+ "wrappy": "1"
+ }
+ },
+ "inherits": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
+ "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=",
+ "dev": true
+ },
+ "invert-kv": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz",
+ "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=",
+ "dev": true
+ },
+ "is-arrayish": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz",
+ "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=",
+ "dev": true
+ },
+ "is-builtin-module": {
+ "version": "1.0.0",
+ "resolved": "http://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz",
+ "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=",
+ "dev": true,
+ "requires": {
+ "builtin-modules": "^1.0.0"
+ }
+ },
+ "is-fullwidth-code-point": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
+ "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
+ "dev": true,
+ "requires": {
+ "number-is-nan": "^1.0.0"
+ }
+ },
+ "is-utf8": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz",
+ "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=",
+ "dev": true
+ },
+ "jsonfile": {
+ "version": "2.4.0",
+ "resolved": "http://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz",
+ "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "^4.1.6"
+ }
+ },
+ "klaw": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz",
+ "integrity": "sha1-QIhDO0azsbolnXh4XY6W9zugJDk=",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "^4.1.9"
+ }
+ },
+ "lcid": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz",
+ "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=",
+ "dev": true,
+ "requires": {
+ "invert-kv": "^1.0.0"
+ }
+ },
+ "load-json-file": {
+ "version": "1.1.0",
+ "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz",
+ "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "^4.1.2",
+ "parse-json": "^2.2.0",
+ "pify": "^2.0.0",
+ "pinkie-promise": "^2.0.0",
+ "strip-bom": "^2.0.0"
+ }
+ },
+ "lodash.assign": {
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-4.2.0.tgz",
+ "integrity": "sha1-DZnzzNem0mHRm9rrkkUAXShYCOc=",
+ "dev": true
+ },
+ "memorystream": {
+ "version": "0.3.1",
+ "resolved": "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz",
+ "integrity": "sha1-htcJCzDORV1j+64S3aUaR93K+bI=",
+ "dev": true
+ },
+ "minimatch": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
+ "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
+ "dev": true,
+ "requires": {
+ "brace-expansion": "^1.1.7"
+ }
+ },
+ "minimist": {
+ "version": "0.0.8",
+ "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
+ "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
+ "dev": true
+ },
+ "mkdirp": {
+ "version": "0.5.1",
+ "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
+ "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
+ "dev": true,
+ "requires": {
+ "minimist": "0.0.8"
+ }
+ },
+ "mocha": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/mocha/-/mocha-4.1.0.tgz",
+ "integrity": "sha512-0RVnjg1HJsXY2YFDoTNzcc1NKhYuXKRrBAG2gDygmJJA136Cs2QlRliZG1mA0ap7cuaT30mw16luAeln+4RiNA==",
+ "dev": true,
+ "requires": {
+ "browser-stdout": "1.3.0",
+ "commander": "2.11.0",
+ "debug": "3.1.0",
+ "diff": "3.3.1",
+ "escape-string-regexp": "1.0.5",
+ "glob": "7.1.2",
+ "growl": "1.10.3",
+ "he": "1.1.1",
+ "mkdirp": "0.5.1",
+ "supports-color": "4.4.0"
+ }
+ },
+ "ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
+ "dev": true
+ },
+ "normalize-package-data": {
+ "version": "2.4.0",
+ "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz",
+ "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==",
+ "dev": true,
+ "requires": {
+ "hosted-git-info": "^2.1.4",
+ "is-builtin-module": "^1.0.0",
+ "semver": "2 || 3 || 4 || 5",
+ "validate-npm-package-license": "^3.0.1"
+ }
+ },
+ "number-is-nan": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz",
+ "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=",
+ "dev": true
+ },
+ "once": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
+ "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
+ "dev": true,
+ "requires": {
+ "wrappy": "1"
+ }
+ },
+ "original-require": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/original-require/-/original-require-1.0.1.tgz",
+ "integrity": "sha1-DxMEcVhM0zURxew4yNWSE/msXiA=",
+ "dev": true
+ },
+ "os-locale": {
+ "version": "1.4.0",
+ "resolved": "http://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz",
+ "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=",
+ "dev": true,
+ "requires": {
+ "lcid": "^1.0.0"
+ }
+ },
+ "parse-json": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz",
+ "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=",
+ "dev": true,
+ "requires": {
+ "error-ex": "^1.2.0"
+ }
+ },
+ "path-exists": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz",
+ "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=",
+ "dev": true,
+ "requires": {
+ "pinkie-promise": "^2.0.0"
+ }
+ },
+ "path-is-absolute": {
+ "version": "1.0.1",
+ "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
+ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
+ "dev": true
+ },
+ "path-type": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz",
+ "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "^4.1.2",
+ "pify": "^2.0.0",
+ "pinkie-promise": "^2.0.0"
+ }
+ },
+ "pathval": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz",
+ "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=",
+ "dev": true
+ },
+ "pify": {
+ "version": "2.3.0",
+ "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
+ "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
+ "dev": true
+ },
+ "pinkie": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz",
+ "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=",
+ "dev": true
+ },
+ "pinkie-promise": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz",
+ "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=",
+ "dev": true,
+ "requires": {
+ "pinkie": "^2.0.0"
+ }
+ },
+ "read-pkg": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz",
+ "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=",
+ "dev": true,
+ "requires": {
+ "load-json-file": "^1.0.0",
+ "normalize-package-data": "^2.3.2",
+ "path-type": "^1.0.0"
+ }
+ },
+ "read-pkg-up": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz",
+ "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=",
+ "dev": true,
+ "requires": {
+ "find-up": "^1.0.0",
+ "read-pkg": "^1.0.0"
+ }
+ },
+ "require-directory": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
+ "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=",
+ "dev": true
+ },
+ "require-from-string": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-1.2.1.tgz",
+ "integrity": "sha1-UpyczvJzgK3+yaL5ZbZJu+5jZBg=",
+ "dev": true
+ },
+ "require-main-filename": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz",
+ "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=",
+ "dev": true
+ },
+ "rimraf": {
+ "version": "2.6.2",
+ "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz",
+ "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==",
+ "dev": true,
+ "requires": {
+ "glob": "^7.0.5"
+ }
+ },
+ "semver": {
+ "version": "5.6.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz",
+ "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==",
+ "dev": true
+ },
+ "set-blocking": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
+ "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=",
+ "dev": true
+ },
+ "solc": {
+ "version": "0.4.24",
+ "resolved": "https://registry.npmjs.org/solc/-/solc-0.4.24.tgz",
+ "integrity": "sha512-2xd7Cf1HeVwrIb6Bu1cwY2/TaLRodrppCq3l7rhLimFQgmxptXhTC3+/wesVLpB09F1A2kZgvbMOgH7wvhFnBQ==",
+ "dev": true,
+ "requires": {
+ "fs-extra": "^0.30.0",
+ "memorystream": "^0.3.1",
+ "require-from-string": "^1.1.0",
+ "semver": "^5.3.0",
+ "yargs": "^4.7.1"
+ }
+ },
+ "spdx-correct": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.0.2.tgz",
+ "integrity": "sha512-q9hedtzyXHr5S0A1vEPoK/7l8NpfkFYTq6iCY+Pno2ZbdZR6WexZFtqeVGkGxW3TEJMN914Z55EnAGMmenlIQQ==",
+ "dev": true,
+ "requires": {
+ "spdx-expression-parse": "^3.0.0",
+ "spdx-license-ids": "^3.0.0"
+ }
+ },
+ "spdx-exceptions": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz",
+ "integrity": "sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA==",
+ "dev": true
+ },
+ "spdx-expression-parse": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz",
+ "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==",
+ "dev": true,
+ "requires": {
+ "spdx-exceptions": "^2.1.0",
+ "spdx-license-ids": "^3.0.0"
+ }
+ },
+ "spdx-license-ids": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.2.tgz",
+ "integrity": "sha512-qky9CVt0lVIECkEsYbNILVnPvycuEBkXoMFLRWsREkomQLevYhtRKC+R91a5TOAQ3bCMjikRwhyaRqj1VYatYg==",
+ "dev": true
+ },
+ "string-width": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
+ "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
+ "dev": true,
+ "requires": {
+ "code-point-at": "^1.0.0",
+ "is-fullwidth-code-point": "^1.0.0",
+ "strip-ansi": "^3.0.0"
+ }
+ },
+ "strip-ansi": {
+ "version": "3.0.1",
+ "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
+ "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "^2.0.0"
+ }
+ },
+ "strip-bom": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz",
+ "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=",
+ "dev": true,
+ "requires": {
+ "is-utf8": "^0.2.0"
+ }
+ },
+ "supports-color": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz",
+ "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^2.0.0"
+ }
+ },
+ "truffle": {
+ "version": "4.1.14",
+ "resolved": "https://registry.npmjs.org/truffle/-/truffle-4.1.14.tgz",
+ "integrity": "sha512-e7tTLvKP3bN9dE7MagfWyFjy4ZgoEGbeujECy1me1ENBzbj/aO/+45gs72qsL3+3IkCNNcWNOJjjrm8BYZZNNg==",
+ "dev": true,
+ "requires": {
+ "mocha": "^4.1.0",
+ "original-require": "1.0.1",
+ "solc": "0.4.24"
+ }
+ },
+ "type-detect": {
+ "version": "4.0.8",
+ "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz",
+ "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==",
+ "dev": true
+ },
+ "validate-npm-package-license": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz",
+ "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==",
+ "dev": true,
+ "requires": {
+ "spdx-correct": "^3.0.0",
+ "spdx-expression-parse": "^3.0.0"
+ }
+ },
+ "which-module": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/which-module/-/which-module-1.0.0.tgz",
+ "integrity": "sha1-u6Y8qGGUiZT/MHc2CJ47lgJsKk8=",
+ "dev": true
+ },
+ "window-size": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.2.0.tgz",
+ "integrity": "sha1-tDFbtCFKPXBY6+7okuE/ok2YsHU=",
+ "dev": true
+ },
+ "wrap-ansi": {
+ "version": "2.1.0",
+ "resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz",
+ "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=",
+ "dev": true,
+ "requires": {
+ "string-width": "^1.0.1",
+ "strip-ansi": "^3.0.1"
+ }
+ },
+ "wrappy": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
+ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
+ "dev": true
+ },
+ "y18n": {
+ "version": "3.2.1",
+ "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz",
+ "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=",
+ "dev": true
+ },
+ "yargs": {
+ "version": "4.8.1",
+ "resolved": "http://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz",
+ "integrity": "sha1-wMQpJMpKqmsObaFznfshZDn53cA=",
+ "dev": true,
+ "requires": {
+ "cliui": "^3.2.0",
+ "decamelize": "^1.1.1",
+ "get-caller-file": "^1.0.1",
+ "lodash.assign": "^4.0.3",
+ "os-locale": "^1.4.0",
+ "read-pkg-up": "^1.0.1",
+ "require-directory": "^2.1.1",
+ "require-main-filename": "^1.0.1",
+ "set-blocking": "^2.0.0",
+ "string-width": "^1.0.1",
+ "which-module": "^1.0.0",
+ "window-size": "^0.2.0",
+ "y18n": "^3.2.1",
+ "yargs-parser": "^2.4.1"
+ }
+ },
+ "yargs-parser": {
+ "version": "2.4.1",
+ "resolved": "http://registry.npmjs.org/yargs-parser/-/yargs-parser-2.4.1.tgz",
+ "integrity": "sha1-hVaN488VD/SfpRgl8DqMiA3cxcQ=",
+ "dev": true,
+ "requires": {
+ "camelcase": "^3.0.0",
+ "lodash.assign": "^4.0.6"
+ }
+ }
+ }
+}
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..0e95224
--- /dev/null
+++ b/package.json
@@ -0,0 +1,25 @@
+{
+ "name": "ds-math",
+ "version": "1.0.0",
+ "description": "
DSMath
",
+ "main": "truffle-config.js",
+ "directories": {
+ "test": "test"
+ },
+ "scripts": {
+ "test": "./node_modules/.bin/truffle test",
+ "compile": "./node_modules/.bin/truffle compile"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git@github.com-as-conda:dapphub/ds-math.git"
+ },
+ "keywords": [],
+ "author": "",
+ "license": "ISC",
+ "devDependencies": {
+ "truffle": "^4.1.14",
+ "chai": "^4.2.0"
+ },
+ "dependencies": {}
+}
diff --git a/test/helpers/shouldFail.js b/test/helpers/shouldFail.js
new file mode 100644
index 0000000..e8159e0
--- /dev/null
+++ b/test/helpers/shouldFail.js
@@ -0,0 +1,39 @@
+//copied from openzeppelin (https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/test/helpers/shouldFail.js)
+
+const should = require('chai')
+ .should();
+
+async function shouldFailWithMessage (promise, message) {
+ try {
+ await promise;
+ } catch (error) {
+ if (message) {
+ error.message.should.include(message, `Wrong failure type, expected '${message}'`);
+ }
+ return;
+ }
+
+ should.fail('Expected failure not received');
+}
+
+async function reverting (promise) {
+ await shouldFailWithMessage(promise, 'revert');
+}
+
+async function throwing (promise) {
+ await shouldFailWithMessage(promise, 'invalid opcode');
+}
+
+async function outOfGas (promise) {
+ await shouldFailWithMessage(promise, 'out of gas');
+}
+
+async function shouldFail (promise) {
+ await shouldFailWithMessage(promise);
+}
+
+shouldFail.reverting = reverting;
+shouldFail.throwing = throwing;
+shouldFail.outOfGas = outOfGas;
+
+module.exports = shouldFail;
diff --git a/test/math.t.test.js b/test/math.t.test.js
new file mode 100644
index 0000000..feff089
--- /dev/null
+++ b/test/math.t.test.js
@@ -0,0 +1,78 @@
+const DSMathTest = artifacts.require("DSMathTest")
+let shouldFail = require('./helpers/shouldFail.js')
+
+contract('DSMathTest', async (accounts) => {
+ let math = null
+
+ before(async () => {
+ math = await DSMathTest.new()
+ })
+
+ it('testFail_add()', async() => {
+ await shouldFail.reverting(math.testFail_add())
+ })
+
+ it('testFail_sub()', async() => {
+ await shouldFail.reverting(math.testFail_sub())
+ })
+
+ it('test_sub()', async() => {
+ await math.test_sub()
+ })
+
+ it('testFail_mul()', async() => {
+ await shouldFail.reverting(math.testFail_mul())
+ })
+
+ it('test_mul()', async() => {
+ await math.test_mul()
+ })
+
+ it('test_min()', async() => {
+ await math.test_min()
+ })
+
+ it('test_max()', async() => {
+ await math.test_max()
+ })
+
+ it('test_imin()', async() => {
+ await math.test_imin()
+ })
+
+ it('test_imax()', async() => {
+ await math.test_imax()
+ })
+
+ it('testFail_wmul_overflow()', async() => {
+ await shouldFail.reverting(math.testFail_wmul_overflow())
+ })
+
+ it('test_wmul_trivial()', async() => {
+ await math.test_wmul_trivial()
+ })
+
+ it('test_wmul_fractions()', async() => {
+ await math.test_wmul_fractions()
+ })
+
+ it('testFail_wdiv_zero()', async() => {
+ await shouldFail.reverting(math.testFail_wdiv_zero())
+ })
+
+ it('test_wdiv_trivial()', async() => {
+ await math.test_wdiv_trivial()
+ })
+
+ it('test_wdiv_fractions()', async() => {
+ await math.test_wdiv_fractions()
+ })
+
+ it('test_wmul_rounding()', async() => {
+ await math.test_wmul_rounding()
+ })
+
+ it('test_rmul_rounding()', async() => {
+ await math.test_rmul_rounding()
+ })
+})
\ No newline at end of file
diff --git a/test/math.test.js b/test/math.test.js
new file mode 100644
index 0000000..5a5306d
--- /dev/null
+++ b/test/math.test.js
@@ -0,0 +1,15 @@
+const DSTest = artifacts.require("DSMath")
+
+contract('Math', async (accounts) => {
+ let math = null
+
+ before(async () => {
+ math = await DSTest.new()
+ })
+
+ it('add()', async() => {
+ const onePlusOne = await math.add(1, 1)
+
+ assert.equal(onePlusOne, 2, "add incorrect")
+ })
+})
\ No newline at end of file
diff --git a/truffle.js b/truffle.js
new file mode 100644
index 0000000..061da5a
--- /dev/null
+++ b/truffle.js
@@ -0,0 +1,11 @@
+
+module.exports = {
+ networks: {
+ development: {
+ host: "localhost",
+ port: 8545,
+ network_id: "*",
+ gas: 4700000 //4700000 is same as ropsten
+ }
+ }
+}
\ No newline at end of file