diff --git a/.gitignore b/.gitignore index d1b4182..01d025f 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,8 @@ .idea/ .vscode/ *.iml +*.swp +tags # don't commit node_modules node_modules @@ -14,3 +16,6 @@ build/ # NPM package generated files: dist/contracts.json + +# Do not track generated wrapper, it should be part of build script +interacts/* diff --git a/.travis.yml b/.travis.yml index 8095f1f..246ade3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,11 +21,12 @@ before_install: - sudo apt-get install nodejs - sudo apt-get install npm install: - - npm install + - npm ci before_script: - - ./tools/runGanacheCli.sh /dev/null 2>&1 & - - npm run compile + - npm run ganache /dev/null 2>&1 & + - npm run compile-all script: + - npm run lint - npm run test - npm run build-package after_script: diff --git a/README.md b/README.md index bdc4a38..ceaa084 100644 --- a/README.md +++ b/README.md @@ -2,56 +2,104 @@ ![Build master](https://img.shields.io/travis/OpenST/organization-contracts/master.svg?label=build%20master&style=flat) ![Build develop](https://img.shields.io/travis/OpenST/organization-contracts/develop.svg?label=build%20develop&style=flat) -![npm version](https://img.shields.io/npm/v/@openstfoundation/organization-contracts.svg?style=flat) [![Discuss on Discourse](https://img.shields.io/discourse/https/discuss.openst.org/topics.svg?style=flat)][discourse] -[![Chat on Gitter](https://img.shields.io/gitter/room/OpenSTFoundation/SimpleToken.svg?style=flat)][gitter] +[![Chat on Gitter](https://img.shields.io/gitter/room/ostdotcom/OST-Platform.svg?style=flat)][gitter] -Organization contracts manage application permissions. +An organization administers other contracts. For an individual contract or a system of contracts, an organization enables limiting execution of certain functions to the organization or other accounts it authorizes (e.g., "workers"). -## Instructions +## Getting Started -### Installation +These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. -> Please add +### Prerequisites -### Usage +Project requires [node] and [npm] to be installed. -> Please add +### Cloning -## Related Work - -[mosaic-contracts] and [openst-contracts] use this package to manage access control. +```bash +git clone git@github.com:OpenST/organization-contracts.git +``` -## Contributing +### Installing -### Set-up +Install npm packages: ```bash -git clone git@github.com:OpenST/organization-contracts.git cd organization-contracts npm install +``` +## Usage + +The contracts and interfaces in this repository are primarily intended for use in other OpenST projects. Please see [Related Work]. + +### Compiling the contracts + +The following npm script compiles updated contracts since the last compile using [truffle]: + +```bash +npm run compile +``` + +To compile all contracts, including the ones that haven't changed: + +```bash npm run compile-all -npm run ganache -npm run test ``` -### Guidelines +### Testing the contracts + +We use the [ganache] blockchain for development. Before running the tests, start `ganache`: + +```bash +npm run ganache-cli +``` + +Test the contracts using [truffle]: + +```bash +npm test +``` + +### Linting + +[ESLint] is used to lint js files. + +To lint all js files within the `./test` and `./tool` directories, run: + +```bash +npm run lint +``` + +## Related Work + +OpenST uses organization contracts and interfaces in [mosaic-contracts], [brandedtoken-contracts], and [openst-contracts] to scale, create, and define blockchain token economies. + +## Contributing There are multiple ways to contribute to this project. However, before contributing, please first review the [Code of Conduct]. We track our [issues] on GitHub. -To contribute code, please ensure that your read the [developer guidelines] first. +To contribute code, please review our [Developer Guidelines] and ensure that your submissions adhere to the [Style Guide]; please also be aware, this project is under active development and we have not yet established firm contribution guidelines or acceptance criteria. ### Community * [Forum][discourse] * [Gitter] -[code of conduct]: https://github.com/OpenST/developer-guidelines/blob/develop/CODE_OF_CONDUCT.md +[brandedtoken-contracts]: https://github.com/OpenSTFoundation/brandedtoken-contracts +[code of conduct]: https://github.com/OpenST/developer-guidelines/blob/master/CODE_OF_CONDUCT.md [developer guidelines]: https://github.com/OpenST/developer-guidelines [discourse]: https://discuss.openst.org/ -[gitter]: https://gitter.im/OpenSTFoundation/SimpleToken +[eslint]: https://eslint.org +[ganache]: https://github.com/trufflesuite/ganache +[gitter]: https://gitter.im/ostdotcom/OST-Platform +[issues]: https://github.com/OpenST/organization-contracts/issues [mosaic-contracts]: https://github.com/OpenSTFoundation/mosaic-contracts +[node]: https://nodejs.org/en/ +[npm]: https://www.npmjs.com/get-npm [openst-contracts]: https://github.com/OpenSTFoundation/openst-contracts -[issues]: https://github.com/OpenST/organization-contracts/issues +[related work]: #related-work +[style guide]: https://github.com/OpenST/developer-guidelines/blob/master/SOLIDITY_STYLE_GUIDE.md +[truffle]: https://github.com/trufflesuite/truffle \ No newline at end of file diff --git a/contracts/Organization.sol b/contracts/Organization.sol index 90911fb..a6955d1 100644 --- a/contracts/Organization.sol +++ b/contracts/Organization.sol @@ -20,10 +20,8 @@ pragma solidity ^0.5.0; // // ---------------------------------------------------------------------------- -import "./lib/SafeMath.sol"; import "./OrganizationInterface.sol"; - /** * @title Organization contract handles an organization and its workers. * @@ -36,12 +34,6 @@ import "./OrganizationInterface.sol"; */ contract Organization is OrganizationInterface { - - /* Using */ - - using SafeMath for uint256; - - /* Events */ /** Emitted when a current owner initiates a change of ownership. */ @@ -211,14 +203,16 @@ contract Organization is OrganizationInterface { } /** - * @notice Sets the admin address. Can only be called by owner or current - * admin. If called by the current admin, adminship is transferred - * to the given address immediately. - * It is discouraged to set the admin address to be the same as the - * address of the owner. The point of the admin is to act on behalf - * of the organization without requiring the possibly very safely - * stored owner key(s). - * Admin can be set to `address(0)` if no admin is desired. + * @notice Sets a new admin address. + * + * An admin address can be set to `address(0)` if no admin is + * desired. + * + * Requires: + * - Only owner or admin can call. + * - A new admin address is not the same as the current + * owner address. + * * * @param _admin Admin address to be set. * @@ -231,14 +225,13 @@ contract Organization is OrganizationInterface { onlyOwnerOrAdmin returns (bool success_) { - /* - * If the address does not change, the call is considered a success, - * but we don't need to emit an event as it did not actually change. - */ - if (admin != _admin) { - emit AdminAddressChanged(_admin, admin); - admin = _admin; - } + require( + owner != _admin, + "A new admin address is the same as the current owner." + ); + + emit AdminAddressChanged(_admin, admin); + admin = _admin; success_ = true; } diff --git a/contracts/lib/SafeMath.sol b/contracts/lib/SafeMath.sol deleted file mode 100644 index 755b950..0000000 --- a/contracts/lib/SafeMath.sol +++ /dev/null @@ -1,143 +0,0 @@ -pragma solidity ^0.5.0; - -// Copyright 2019 OpenST Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ---------------------------------------------------------------------------- -// -// http://www.simpletoken.org/ -// -// Based on the SafeMath library by the OpenZeppelin team. -// Copyright (c) 2018 Smart Contract Solutions, Inc. -// https://github.com/OpenZeppelin/zeppelin-solidity -// The MIT License. -// ---------------------------------------------------------------------------- - - -/** - * @title SafeMath library. - * - * @notice Based on the SafeMath library by the OpenZeppelin team. - * - * @dev Math operations with safety checks that revert on error. - */ -library SafeMath { - - /* Internal Functions */ - - /** - * @notice Multiplies two numbers, reverts on overflow. - * - * @param a Unsigned integer multiplicand. - * @param b Unsigned integer multiplier. - * - * @return uint256 Product. - */ - function mul(uint256 a, uint256 b) internal pure returns (uint256) { - /* - * Gas optimization: this is cheaper than requiring 'a' not being zero, - * but the benefit is lost if 'b' is also tested. - * See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 - */ - if (a == 0) { - return 0; - } - - uint256 c = a * b; - require( - c / a == b, - "Overflow when multiplying." - ); - - return c; - } - - /** - * @notice Integer division of two numbers truncating the quotient, reverts - * on division by zero. - * - * @param a Unsigned integer dividend. - * @param b Unsigned integer divisor. - * - * @return uint256 Quotient. - */ - function div(uint256 a, uint256 b) internal pure returns (uint256) { - // Solidity only automatically asserts when dividing by 0. - require( - b > 0, - "Cannot do attempted division by less than or equal to zero." - ); - uint256 c = a / b; - - // There is no case in which the following doesn't hold: - // assert(a == b * c + a % b); - - return c; - } - - /** - * @notice Subtracts two numbers, reverts on underflow (i.e. if subtrahend - * is greater than minuend). - * - * @param a Unsigned integer minuend. - * @param b Unsigned integer subtrahend. - * - * @return uint256 Difference. - */ - function sub(uint256 a, uint256 b) internal pure returns (uint256) { - require( - b <= a, - "Underflow when subtracting." - ); - uint256 c = a - b; - - return c; - } - - /** - * @notice Adds two numbers, reverts on overflow. - * - * @param a Unsigned integer augend. - * @param b Unsigned integer addend. - * - * @return uint256 Sum. - */ - function add(uint256 a, uint256 b) internal pure returns (uint256) { - uint256 c = a + b; - require( - c >= a, - "Overflow when adding." - ); - - return c; - } - - /** - * @notice Divides two numbers and returns the remainder (unsigned integer - * modulo), reverts when dividing by zero. - * - * @param a Unsigned integer dividend. - * @param b Unsigned integer divisor. - * - * @return uint256 Remainder. - */ - function mod(uint256 a, uint256 b) internal pure returns (uint256) { - require( - b != 0, - "Cannot do attempted division by zero (in `mod()`)." - ); - - return a % b; - } -} diff --git a/contracts/test/lib/TestSafeMath.sol b/contracts/test/lib/TestSafeMath.sol deleted file mode 100644 index b4e7674..0000000 --- a/contracts/test/lib/TestSafeMath.sol +++ /dev/null @@ -1,85 +0,0 @@ -pragma solidity ^0.5.0; - -// Copyright 2019 OpenST Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ---------------------------------------------------------------------------- -// Common: SafeMath Library Implementation -// -// http://www.simpletoken.org/ -// -// Based on the SafeMath library by the OpenZeppelin team. -// Copyright (c) 2016 Smart Contract Solutions, Inc. -// https://github.com/OpenZeppelin/zeppelin-solidity -// The MIT License. -// ---------------------------------------------------------------------------- - -import "../../lib/SafeMath.sol"; - -/** - * @title TestSafeMath library. - * - * @notice Based on the SafeMath library by the OpenZeppelin team. - * Mock used for testing. - */ -contract TestSafeMath { - - /** Storage */ - - uint256 public result; - - /* Public functions */ - - /** - * @notice Public function multiply. - * - * @dev Public wrapper for SafeMath function mul. - * - * @param a Unsigned integer multiplicand. - * @param b Unsigned integer multiplier. - * - * @return uint256 Product. - */ - function multiply(uint256 a, uint256 b) public { - result = SafeMath.mul(a, b); - } - - /** - * @notice Public function subtract. - * - * @dev Public wrapper for SafeMath function sub. - * - * @param a Unsigned integer minuend. - * @param b Unsigned integer subtrahend. - * - * @return uint256 Difference. - */ - function subtract(uint256 a, uint256 b) public { - result = SafeMath.sub(a, b); - } - - /** - * @notice Public function add. - * - * @dev Public wrapper for SafeMath function add. - * - * @param a Unsigned integer augend. - * @param b Unsigned integer addend. - * - * @return uint256 Sum. - */ - function add(uint256 a, uint256 b) public { - result = SafeMath.add(a, b); - } -} diff --git a/package-lock.json b/package-lock.json index a2f9789..f5ad4be 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,12 +24,36 @@ "js-tokens": "^4.0.0" } }, + "@types/mkdirp": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/@types/mkdirp/-/mkdirp-0.5.2.tgz", + "integrity": "sha512-U5icWpv7YnZYGsN4/cmh3WD2onMY0aJIiTE6+51TwJCttdHvtCYmkBNOobHlXwrJRL0nkH9jH4kD+1FAdMN4Tg==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, "@types/node": { "version": "10.12.29", "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.29.tgz", "integrity": "sha512-J/tnbnj8HcsBgCe2apZbdUpQ7hs4d7oZNTYA5bekWdP0sr2NGsOpI/HRdDroEi209tEvTcTtxhD0FfED3DhEcw==", "dev": true }, + "@types/prettier": { + "version": "1.16.3", + "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-1.16.3.tgz", + "integrity": "sha512-5Ksgx9H/Yjz6oamDbmDZstWlJGPTao7shNfambjf8o7OkHxDwAi0AJLQcFwS9pDKI4gQPdiKZXze3nT1eCOViQ==", + "dev": true + }, + "@types/resolve": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-0.0.8.tgz", + "integrity": "sha512-auApPaJf3NPfe18hSoJkp8EbZzer2ISk7o8mCC3M9he/a04+gbMF97NkpD2S8riMGvm4BMRI59/SZQSaLTKpsQ==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, "abi-decoder": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/abi-decoder/-/abi-decoder-1.2.0.tgz", @@ -136,6 +160,15 @@ "sprintf-js": "~1.0.2" } }, + "array-back": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/array-back/-/array-back-2.0.0.tgz", + "integrity": "sha512-eJv4pLLufP3g5kcZry0j6WXpIbzYw9GUB4mVJZno9wfwiBxbizTnHCw3VJb07cBihbFX48Y7oSrW9y+gt4glyw==", + "dev": true, + "requires": { + "typical": "^2.6.1" + } + }, "array-flatten": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", @@ -455,12 +488,6 @@ "integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw=", "dev": true }, - "buffer-from": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", - "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", - "dev": true - }, "buffer-to-arraybuffer": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.5.tgz", @@ -615,6 +642,17 @@ "delayed-stream": "~1.0.0" } }, + "command-line-args": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/command-line-args/-/command-line-args-4.0.7.tgz", + "integrity": "sha512-aUdPvQRAyBvQd2n7jXcsMDz68ckBJELXNzBybCHOibUWEg0mWTnaYCSRU8h9R+aNRSvDihJtssSRCiDRpLaezA==", + "dev": true, + "requires": { + "array-back": "^2.0.0", + "find-replace": "^1.0.3", + "typical": "^2.6.1" + } + }, "commander": { "version": "2.15.1", "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", @@ -1641,6 +1679,27 @@ } } }, + "find-replace": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/find-replace/-/find-replace-1.0.3.tgz", + "integrity": "sha1-uI5zZNLZyVlVnziMZmcNYTBEH6A=", + "dev": true, + "requires": { + "array-back": "^1.0.4", + "test-value": "^2.1.0" + }, + "dependencies": { + "array-back": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/array-back/-/array-back-1.0.4.tgz", + "integrity": "sha1-ZEun8JX3/898Q7Xw3DnTwfA8Bjs=", + "dev": true, + "requires": { + "typical": "^2.6.0" + } + } + } + }, "find-up": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", @@ -1707,16 +1766,25 @@ "dev": true }, "fs-extra": { - "version": "0.30.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz", - "integrity": "sha1-8jP/zAjU2n1DLapEl3aYnbHfk/A=", + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.0.1.tgz", + "integrity": "sha512-W+XLrggcDzlle47X/XnS7FXrXu9sDo+Ze9zpndeBxdgv88FHLm1HtmkhEwavruS6koanBjp098rUpHs65EmG7A==", "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" + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "dependencies": { + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.6" + } + } } }, "fs-promise": { @@ -1750,9 +1818,9 @@ "dev": true }, "fstream": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.11.tgz", - "integrity": "sha1-XB+x8RdHcRTwYyoOtLcbPLD9MXE=", + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz", + "integrity": "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==", "dev": true, "requires": { "graceful-fs": "^4.1.2", @@ -1774,12 +1842,382 @@ "dev": true }, "ganache-cli": { - "version": "6.1.8", - "resolved": "https://registry.npmjs.org/ganache-cli/-/ganache-cli-6.1.8.tgz", - "integrity": "sha512-yXzteu4SIgUL31mnpm9j+x6dpHUw0p/nsRVkcySKq0w+1vDxH9jMErP1QhZAJuTVE6ni4nfvGSNkaQx5cD3jfg==", + "version": "6.4.3", + "resolved": "https://registry.npmjs.org/ganache-cli/-/ganache-cli-6.4.3.tgz", + "integrity": "sha512-3G+CK4ojipDvxQHlpX8PjqaOMRWVcaLZZSW97Bv7fdcPTXQwkji2yY5CY6J12Atiub4M4aJc0va+q3HXeerbIA==", "dev": true, "requires": { - "source-map-support": "^0.5.3" + "bn.js": "4.11.8", + "source-map-support": "0.5.9", + "yargs": "11.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "bundled": true, + "dev": true + }, + "bn.js": { + "version": "4.11.8", + "bundled": true, + "dev": true + }, + "buffer-from": { + "version": "1.1.1", + "bundled": true, + "dev": true + }, + "camelcase": { + "version": "4.1.0", + "bundled": true, + "dev": true + }, + "cliui": { + "version": "4.1.0", + "bundled": true, + "dev": true, + "requires": { + "string-width": "^2.1.1", + "strip-ansi": "^4.0.0", + "wrap-ansi": "^2.0.0" + } + }, + "code-point-at": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "cross-spawn": { + "version": "5.1.0", + "bundled": true, + "dev": true, + "requires": { + "lru-cache": "^4.0.1", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "decamelize": { + "version": "1.2.0", + "bundled": true, + "dev": true + }, + "execa": { + "version": "0.7.0", + "bundled": true, + "dev": true, + "requires": { + "cross-spawn": "^5.0.1", + "get-stream": "^3.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "find-up": { + "version": "2.1.0", + "bundled": true, + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + }, + "get-caller-file": { + "version": "1.0.3", + "bundled": true, + "dev": true + }, + "get-stream": { + "version": "3.0.0", + "bundled": true, + "dev": true + }, + "invert-kv": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "bundled": true, + "dev": true + }, + "is-stream": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "isexe": { + "version": "2.0.0", + "bundled": true, + "dev": true + }, + "lcid": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "requires": { + "invert-kv": "^1.0.0" + } + }, + "locate-path": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + } + }, + "lru-cache": { + "version": "4.1.4", + "bundled": true, + "dev": true, + "requires": { + "pseudomap": "^1.0.2", + "yallist": "^3.0.2" + } + }, + "mem": { + "version": "1.1.0", + "bundled": true, + "dev": true, + "requires": { + "mimic-fn": "^1.0.0" + } + }, + "mimic-fn": { + "version": "1.2.0", + "bundled": true, + "dev": true + }, + "npm-run-path": { + "version": "2.0.2", + "bundled": true, + "dev": true, + "requires": { + "path-key": "^2.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "os-locale": { + "version": "2.1.0", + "bundled": true, + "dev": true, + "requires": { + "execa": "^0.7.0", + "lcid": "^1.0.0", + "mem": "^1.1.0" + } + }, + "p-finally": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "p-limit": { + "version": "1.3.0", + "bundled": true, + "dev": true, + "requires": { + "p-try": "^1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "requires": { + "p-limit": "^1.1.0" + } + }, + "p-try": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "path-exists": { + "version": "3.0.0", + "bundled": true, + "dev": true + }, + "path-key": { + "version": "2.0.1", + "bundled": true, + "dev": true + }, + "pseudomap": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "require-directory": { + "version": "2.1.1", + "bundled": true, + "dev": true + }, + "require-main-filename": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "set-blocking": { + "version": "2.0.0", + "bundled": true, + "dev": true + }, + "shebang-command": { + "version": "1.2.0", + "bundled": true, + "dev": true, + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "signal-exit": { + "version": "3.0.2", + "bundled": true, + "dev": true + }, + "source-map": { + "version": "0.6.1", + "bundled": true, + "dev": true + }, + "source-map-support": { + "version": "0.5.9", + "bundled": true, + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "string-width": { + "version": "2.1.1", + "bundled": true, + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "bundled": true, + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + }, + "strip-eof": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "which": { + "version": "1.3.1", + "bundled": true, + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "which-module": { + "version": "2.0.0", + "bundled": true, + "dev": true + }, + "wrap-ansi": { + "version": "2.1.0", + "bundled": true, + "dev": true, + "requires": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "bundled": true, + "dev": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "string-width": { + "version": "1.0.2", + "bundled": true, + "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", + "bundled": true, + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + } + } + }, + "y18n": { + "version": "3.2.1", + "bundled": true, + "dev": true + }, + "yallist": { + "version": "3.0.2", + "bundled": true, + "dev": true + }, + "yargs": { + "version": "11.1.0", + "bundled": true, + "dev": true, + "requires": { + "cliui": "^4.0.0", + "decamelize": "^1.1.1", + "find-up": "^2.1.0", + "get-caller-file": "^1.0.1", + "os-locale": "^2.0.0", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^2.0.0", + "which-module": "^2.0.0", + "y18n": "^3.2.1", + "yargs-parser": "^9.0.2" + } + }, + "yargs-parser": { + "version": "9.0.2", + "bundled": true, + "dev": true, + "requires": { + "camelcase": "^4.1.0" + } + } } }, "get-caller-file": { @@ -2250,9 +2688,9 @@ "dev": true }, "js-yaml": { - "version": "3.12.2", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.2.tgz", - "integrity": "sha512-QHn/Lh/7HhZ/Twc7vJYQTkjuCa0kaCcDcjK5Zlk2rvnUpy7DxMJ23+Jc2dcyvltwQVg1nygAVlB2oRDFHoRS5Q==", + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", "dev": true, "requires": { "argparse": "^1.0.7", @@ -2809,6 +3247,12 @@ "mimic-fn": "^1.0.0" } }, + "openzeppelin-solidity": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/openzeppelin-solidity/-/openzeppelin-solidity-2.1.1.tgz", + "integrity": "sha512-kvVI/2n3oYfVYP53rUw+q6QNPlorwYRFaGu/Zs+TWFw2tKlnrz7UXh0UTWYd3Sfbq6eOo4XXnGv4bgcKguOrWg==", + "dev": true + }, "optionator": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", @@ -3054,6 +3498,12 @@ "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=", "dev": true }, + "prettier": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.17.0.tgz", + "integrity": "sha512-sXe5lSt2WQlCbydGETgfm1YBShgOX4HxQkFPvbxkcwgDvGDeqVau8h+12+lmSVlP3rHPz0oavfddSZg/q+Szjw==", + "dev": true + }, "process": { "version": "0.5.2", "resolved": "https://registry.npmjs.org/process/-/process-0.5.2.tgz", @@ -3608,22 +4058,21 @@ "require-from-string": "^2.0.0", "semver": "^5.5.0", "yargs": "^11.0.0" - } - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - }, - "source-map-support": { - "version": "0.5.10", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.10.tgz", - "integrity": "sha512-YfQ3tQFTK/yzlGJuX8pTwa4tifQj4QS2Mj7UegOu8jAz59MqIiMGPXxQhVQiIMNzayuUSF/jEuVnfFF5JqybmQ==", - "dev": true, - "requires": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" + }, + "dependencies": { + "fs-extra": { + "version": "0.30.0", + "resolved": "https://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" + } + } } }, "spdx-correct": { @@ -3851,13 +4300,13 @@ } }, "tar": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.1.tgz", - "integrity": "sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE=", + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.2.tgz", + "integrity": "sha512-FCEhQ/4rE1zYv9rYXJw/msRqsnmlje5jHP6huWeBZ704jUTy02c5AZyWujpMR1ax6mVw9NyJMfuK2CMDWVIfgA==", "dev": true, "requires": { "block-stream": "*", - "fstream": "^1.0.2", + "fstream": "^1.0.12", "inherits": "2" } }, @@ -3897,6 +4346,27 @@ } } }, + "test-value": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/test-value/-/test-value-2.1.0.tgz", + "integrity": "sha1-Edpv9nDzRxpztiXKTz/c97t0gpE=", + "dev": true, + "requires": { + "array-back": "^1.0.3", + "typical": "^2.6.0" + }, + "dependencies": { + "array-back": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/array-back/-/array-back-1.0.4.tgz", + "integrity": "sha1-ZEun8JX3/898Q7Xw3DnTwfA8Bjs=", + "dev": true, + "requires": { + "typical": "^2.6.0" + } + } + } + }, "text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", @@ -3967,9 +4437,9 @@ } }, "truffle": { - "version": "5.0.6", - "resolved": "https://registry.npmjs.org/truffle/-/truffle-5.0.6.tgz", - "integrity": "sha512-SBk42qft5ElzdAoolHzy3TIzIrh/GmbEiI+kKoj2nj4GYZtHdXePWA+cp7AwzhNuXiMaR4UwYqVVhn8yxOiAXg==", + "version": "5.0.19", + "resolved": "https://registry.npmjs.org/truffle/-/truffle-5.0.19.tgz", + "integrity": "sha512-d4fxChHYCjccW33IO/4KLcGqjTDn+mw7vqdGvGi307CMo+KTtns+5c91+1iOKDQcSKiv8SHYgvtyF7cn/+FPAg==", "dev": true, "requires": { "app-module-path": "^2.2.0", @@ -4066,6 +4536,29 @@ } } }, + "ts-essentials": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/ts-essentials/-/ts-essentials-1.0.4.tgz", + "integrity": "sha512-q3N1xS4vZpRouhYHDPwO0bDW3EZ6SK9CrrDHxi/D6BPReSjpVgWIOpLS2o0gSBZm+7q/wyKp6RVM1AeeW7uyfQ==", + "dev": true + }, + "ts-generator": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/ts-generator/-/ts-generator-0.0.8.tgz", + "integrity": "sha512-Gi+aZCELpVL7Mqb+GuMgM+n8JZ/arZZib1iD/R9Ok8JDjOCOCrqS9b1lr72ku7J45WeDCFZxyJoRsiQvhokCnw==", + "dev": true, + "requires": { + "@types/mkdirp": "^0.5.2", + "@types/prettier": "^1.13.2", + "@types/resolve": "^0.0.8", + "chalk": "^2.4.1", + "glob": "^7.1.2", + "mkdirp": "^0.5.1", + "prettier": "^1.14.2", + "resolve": "^1.8.1", + "ts-essentials": "^1.0.0" + } + }, "tslib": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz", @@ -4112,6 +4605,49 @@ "mime-types": "~2.1.18" } }, + "typechain": { + "version": "0.3.14", + "resolved": "https://registry.npmjs.org/typechain/-/typechain-0.3.14.tgz", + "integrity": "sha512-nOg7n7LngcA4Sx53q+4jjSpIEulEayZYnCMfyItnyxCX3nTCWVg8QXZppMDYNfITkJHex0v5dTgklOQzSbfUkw==", + "dev": true, + "requires": { + "command-line-args": "^4.0.7", + "debug": "^3.0.1", + "fs-extra": "^7.0.0", + "ts-generator": "^0.0.8" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "fs-extra": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", + "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.6" + } + } + } + }, "typedarray-to-buffer": { "version": "3.1.5", "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", @@ -4121,6 +4657,18 @@ "is-typedarray": "^1.0.0" } }, + "typescript": { + "version": "3.4.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.4.5.tgz", + "integrity": "sha512-YycBxUb49UUhdNMU5aJ7z5Ej2XGmaIBL0x34vZ82fn3hGvD+bgrMrVDpatgz2f7YxUMJxMkbWxJZeAvDxVe7Vw==", + "dev": true + }, + "typical": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/typical/-/typical-2.6.1.tgz", + "integrity": "sha1-XAgOXWYcu+OCWdLnCjxyU+hziB0=", + "dev": true + }, "ultron": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", @@ -4143,6 +4691,12 @@ "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=", "dev": true }, + "universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "dev": true + }, "unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", diff --git a/package.json b/package.json index fc3fc94..95cf978 100644 --- a/package.json +++ b/package.json @@ -10,10 +10,12 @@ "compile": "truffle compile", "compile-all": "truffle compile --all", "test": "truffle test", - "ganache": "sh tools/runGanacheCli.sh", + "ganache": "./tools/runGanacheCli.sh", "build-package": "node tools/build_package.js", - "prepack": "npm run compile-all && npm run build-package", - "lint": "eslint test tools -c .eslintrc.json --ext js" + "prepack": "npm run compile-all && npm run generate && npm run build-package && ./node_modules/.bin/tsc ./dist/*.ts", + "lint": "eslint test tools -c .eslintrc.json --ext js", + "generate": "ts-generator ts-generator.json", + "postinstall": "npm run compile-all && npm run generate" }, "repository": { "type": "git", @@ -44,9 +46,14 @@ "eslint": "5.10.0", "eslint-config-airbnb-base": "13.1.0", "eslint-plugin-import": "2.14.0", - "ganache-cli": "6.1.8", + "fs-extra": "8.0.1", + "ganache-cli": "6.4.3", "mocha": "5.2.0", - "truffle": "5.0.6", + "openzeppelin-solidity": "2.1.1", + "truffle": "5.0.19", + "ts-generator": "0.0.8", + "typechain": "0.3.14", + "typescript": "3.4.5", "web3": "1.0.0-beta.36" } } diff --git a/test/lib/safe_math.js b/test/lib/safe_math.js deleted file mode 100644 index aa68f7b..0000000 --- a/test/lib/safe_math.js +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2019 OpenST Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ---------------------------------------------------------------------------- -// Utility chain: OpenSTUtility -// -// http://www.simpletoken.org/ -// -// Based on the SafeMath library by the OpenZeppelin team. -// Copyright (c) 2016 Smart Contract Solutions, Inc. -// https://github.com/OpenZeppelin/zeppelin-solidity -// The MIT License. -// ---------------------------------------------------------------------------- - -const BN = require('bn.js'); -const Utils = require('../test_lib/utils.js'); - -const TestSafeMath = artifacts.require('TestSafeMath'); - -contract('SafeMath', () => { - let safeMath; - - before(async () => { - safeMath = await TestSafeMath.new(); - }); - - it('multiplies correctly', async () => { - const a = 5678; - const b = 1234; - await safeMath.multiply(a, b); - const result = await safeMath.result(); - assert.equal(result, a * b); - }); - - it('adds correctly', async () => { - const a = 5678; - const b = 1234; - await safeMath.add(a, b); - const result = await safeMath.result(); - - assert.equal(result, a + b); - }); - - it('subtracts correctly', async () => { - const a = 5678; - const b = 1234; - await safeMath.subtract(a, b); - const result = await safeMath.result(); - - assert.equal(result, a - b); - }); - - it('should throw an error if subtraction result would be negative', async () => { - const a = 1234; - const b = 5678; - await Utils.expectThrow(safeMath.subtract(a, b)); - }); - - it('should throw an error on addition overflow', async () => { - const a = new BN( - '115792089237316195423570985008687907853269984665640564039457584007913129639935', - ); - const b = new BN(1); - await Utils.expectThrow(safeMath.add(a, b)); - }); - - it('should throw an error on multiplication overflow', async () => { - const a = new BN( - '115792089237316195423570985008687907853269984665640564039457584007913129639933', - ); - const b = new BN(2); - await Utils.expectThrow(safeMath.multiply(a, b)); - }); -}); diff --git a/test/organization/constructor.js b/test/organization/constructor.js index 4991d2e..ea2b105 100644 --- a/test/organization/constructor.js +++ b/test/organization/constructor.js @@ -91,6 +91,7 @@ contract('Organization.constructor()', async (accounts) => { const count = workers.length; for (let i = 0; i < count; i += 1) { const worker = workers[i]; + // eslint-disable-next-line no-await-in-loop const setExpirationHeight = await organization.workers.call(worker); assert( setExpirationHeight.eqn(expirationHeight), diff --git a/test/organization/is_worker.js b/test/organization/is_worker.js index 3bcd9bf..893bddb 100644 --- a/test/organization/is_worker.js +++ b/test/organization/is_worker.js @@ -57,6 +57,7 @@ contract('Organization.isWorker()', async (accounts) => { // Dummy Transaction to increase block number. for (let i = 0; i < deltaExpirationHeight; i += 1) { + // eslint-disable-next-line no-await-in-loop await Utils.advanceBlock(); } assert.strictEqual( @@ -79,6 +80,7 @@ contract('Organization.isWorker()', async (accounts) => { */ for (let i = 0; i < deltaExpirationHeight - 1; i += 1) { assert.strictEqual( + // eslint-disable-next-line no-await-in-loop await organization.isWorker.call(worker), true, 'The worker should be active at this height.', diff --git a/test/organization/set_admin.js b/test/organization/set_admin.js index 41bfe6f..fd3dcd1 100644 --- a/test/organization/set_admin.js +++ b/test/organization/set_admin.js @@ -48,6 +48,13 @@ contract('Organization.setAdmin()', async (accounts) => { ); }); + it('reverts when new admin address is the same as the current owner address', async () => { + await Utils.expectRevert( + organization.setAdmin(owner, { from: owner }), + 'A new admin address is the same as the current owner.', + ); + }); + it('should pass when valid admin is passed by owner', async () => { const newAdmin = accounts[2]; await organization.setAdmin(newAdmin, { from: owner }); @@ -92,6 +99,7 @@ contract('Organization.setAdmin()', async (accounts) => { admin, 'The event should emit the correct admin address.', ); + assert.strictEqual( events.AdminAddressChanged.previousAdmin, previousAdmin, @@ -99,21 +107,20 @@ contract('Organization.setAdmin()', async (accounts) => { ); }); - it('Should not emit an event when the address did not change', async () => { - await organization.setAdmin(admin, { from: owner }); - - /* - * The address was already set before. This should pass, but not emit an - * event. - */ - const transaction = await organization.setAdmin(admin, { from: owner }); + it('Should emit an event when the address did not change', async () => { + const currentAdmin = await organization.admin.call(); + const transaction = await organization.setAdmin(currentAdmin, { from: owner }); const events = EventsDecoder.getEvents(transaction, organization); assert.strictEqual( - events.AdminAddressChanged, - undefined, - 'The event should not be emitted when the address does not change.', + events.AdminAddressChanged.previousAdmin, + currentAdmin, + ); + + assert.strictEqual( + events.AdminAddressChanged.newAdmin, + currentAdmin, ); }); }); diff --git a/test/organization/set_worker.js b/test/organization/set_worker.js index ba0e098..6636f12 100644 --- a/test/organization/set_worker.js +++ b/test/organization/set_worker.js @@ -68,6 +68,7 @@ contract('Organization.setWorker()', async (accounts) => { const blockNumber = await web3.eth.getBlockNumber(); expirationHeight = blockNumber + expirationHeightDelta; for (let i = 0; i < expirationHeightDelta; i += 1) { + // eslint-disable-next-line no-await-in-loop await Utils.advanceBlock(); } diff --git a/test/test_lib/event_decoder.js b/test/test_lib/event_decoder.js index 8f1c04d..8f63599 100644 --- a/test/test_lib/event_decoder.js +++ b/test/test_lib/event_decoder.js @@ -21,6 +21,8 @@ 'use strict'; +const abiDecoder = require('abi-decoder'); + class Web3EventsDecoder { static getFormattedEvents(eventsData) { const formattedEvents = {}; @@ -68,7 +70,7 @@ class Web3EventsDecoder { // Transaction receipt not found if (!txReceipt) { console.error(' Transaction receipt was not found.'); - return; + return {}; } // Block not yet mined @@ -76,52 +78,40 @@ class Web3EventsDecoder { console.error( ' Transaction not yet mined. Please try after some time. ', ); - return; + return {}; } let logs = []; // Backwards compatibility: if (txReceipt.logs.length > 0) { - logs = txReceipt.logs; + ({ logs } = txReceipt); } else if (txReceipt.rawLogs.length > 0) { logs = txReceipt.rawLogs; } if (logs.length > 0) { - const abiDecoder = require('abi-decoder'); - const relevantLogs = []; - for (let i = 0; i < logs.length; i++) { + for (let i = 0; i < logs.length; i += 1) { const log = logs[i]; const currContractAddrFromReceipt = log.address; - if (!currContractAddrFromReceipt) { - // No contract found for contract address. - continue; - } - - if (currContractAddrFromReceipt != contractAddr) { - // Skipping event of contract that is not under inspection. - continue; - } - - if (log.topics === undefined || log.topics.length === 0) { - // Logs that have an event already don't need to be encoded. - if (log.event !== undefined) { - decodedEvents.push(log); + if (currContractAddrFromReceipt && currContractAddrFromReceipt === contractAddr) { + if (log.topics === undefined || log.topics.length === 0) { + if (log.event !== undefined) { + decodedEvents.push(log); + } + } else { + if (!contractAbi) { + // ABI not found for contract. + return {}; + } + + relevantLogs.push(log); + abiDecoder.addABI(contractAbi); } - continue; - } - - if (!contractAbi) { - // ABI not found for contract. - return; } - - relevantLogs.push(log); - abiDecoder.addABI(contractAbi); } if (relevantLogs.length > 0) { diff --git a/ts-generator.json b/ts-generator.json new file mode 100644 index 0000000..c3db12c --- /dev/null +++ b/ts-generator.json @@ -0,0 +1,8 @@ +[ + { + "generator": "typechain", + "files": "./build/**/*/!(Migrations.json)", + "target": "web3-1.0.0", + "outDir" : "interacts" + } +] \ No newline at end of file