aboutsummaryrefslogtreecommitdiffstats
path: root/packages/deployer
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2018-03-09 00:43:16 +0800
committerBrandon Millman <brandon.millman@gmail.com>2018-03-09 00:43:16 +0800
commit098dae9a7e57385505f0f272fd76d44f43fa1e34 (patch)
treebcd47532910e5804746ec88c8d9f6b85c157d6e1 /packages/deployer
parent5b5037a844f49c17deeaf695fc8ed57832038da6 (diff)
parentaaa7affa46450bb48639e9b90c2a2e8adb28826c (diff)
downloaddexon-sol-tools-098dae9a7e57385505f0f272fd76d44f43fa1e34.tar
dexon-sol-tools-098dae9a7e57385505f0f272fd76d44f43fa1e34.tar.gz
dexon-sol-tools-098dae9a7e57385505f0f272fd76d44f43fa1e34.tar.bz2
dexon-sol-tools-098dae9a7e57385505f0f272fd76d44f43fa1e34.tar.lz
dexon-sol-tools-098dae9a7e57385505f0f272fd76d44f43fa1e34.tar.xz
dexon-sol-tools-098dae9a7e57385505f0f272fd76d44f43fa1e34.tar.zst
dexon-sol-tools-098dae9a7e57385505f0f272fd76d44f43fa1e34.zip
Merge branch 'development' into feature/sra-reporter
* development: (68 commits) Update list of packages and organize them alphabetically Fix prettier issues Add support for going back to previous hashes via the browser back button to wiki Scroll to previous hashed elements when user clicks back button Add back strict null checks to react-shared package and fix issues remove ability to have implicit dependencies and add missing deps update license remove no-implicit-this Add example & screenshot to npmignore Remove `;` to be nice to windows users Use unencoded @ symbol, browser will fix Fix external type links Add comment about commented out CSS exception Update prettier since the previous version had a bug when dealing with css files Fix css files with prettier Added base-contract package to README Prettify test jsons Update yarn.lock Improve README Feedback ...
Diffstat (limited to 'packages/deployer')
-rw-r--r--packages/deployer/CHANGELOG.md3
-rw-r--r--packages/deployer/src/deployer.ts14
2 files changed, 15 insertions, 2 deletions
diff --git a/packages/deployer/CHANGELOG.md b/packages/deployer/CHANGELOG.md
index 05383bed5..ccfdd6a3b 100644
--- a/packages/deployer/CHANGELOG.md
+++ b/packages/deployer/CHANGELOG.md
@@ -2,7 +2,8 @@
## v0.2.0 - _March 4, 2018_
- * Check dependencies when determining if contracts should be recompiled (#408).
+ * Check dependencies when determining if contracts should be recompiled (#408)
+ * Improve an error message for when deployer is supplied with an incorrect number of constructor arguments (#419)
## v0.1.0 - _February 16, 2018_
diff --git a/packages/deployer/src/deployer.ts b/packages/deployer/src/deployer.ts
index 6710bcc85..e87d2ab0e 100644
--- a/packages/deployer/src/deployer.ts
+++ b/packages/deployer/src/deployer.ts
@@ -1,4 +1,4 @@
-import { TxData } from '@0xproject/types';
+import { AbiType, TxData } from '@0xproject/types';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as _ from 'lodash';
import * as Web3 from 'web3';
@@ -49,6 +49,18 @@ export class Deployer {
gas,
};
const abi = contractNetworkDataIfExists.abi;
+ const constructorAbi = _.find(abi, { type: AbiType.Constructor }) as Web3.ConstructorAbi;
+ const constructorArgs = _.isUndefined(constructorAbi) ? [] : constructorAbi.inputs;
+ if (constructorArgs.length !== args.length) {
+ const constructorSignature = `constructor(${_.map(constructorArgs, arg => `${arg.type} ${arg.name}`).join(
+ ', ',
+ )})`;
+ throw new Error(
+ `${contractName} expects ${constructorArgs.length} constructor params: ${constructorSignature}. Got ${
+ args.length
+ }`,
+ );
+ }
const web3ContractInstance = await this._deployFromAbiAsync(abi, args, txData);
utils.consoleLog(`${contractName}.sol successfully deployed at ${web3ContractInstance.address}`);
const contractInstance = new Contract(web3ContractInstance, this._defaults);