aboutsummaryrefslogtreecommitdiffstats
path: root/packages/deployer/src
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-03-08 23:40:46 +0800
committerFabio Berger <me@fabioberger.com>2018-03-08 23:40:46 +0800
commit98e8105ec5a629ce67f34216df72e11422649c4e (patch)
treea30bc127779789aae5eff5457366264d09a9e31b /packages/deployer/src
parent4a94a2b4e81d8b5d773ebeaa671b78ac4bf9a408 (diff)
parent03902b0b26fe443705dde20c42e78e1cb4bd3c4b (diff)
downloaddexon-sol-tools-98e8105ec5a629ce67f34216df72e11422649c4e.tar
dexon-sol-tools-98e8105ec5a629ce67f34216df72e11422649c4e.tar.gz
dexon-sol-tools-98e8105ec5a629ce67f34216df72e11422649c4e.tar.bz2
dexon-sol-tools-98e8105ec5a629ce67f34216df72e11422649c4e.tar.lz
dexon-sol-tools-98e8105ec5a629ce67f34216df72e11422649c4e.tar.xz
dexon-sol-tools-98e8105ec5a629ce67f34216df72e11422649c4e.tar.zst
dexon-sol-tools-98e8105ec5a629ce67f34216df72e11422649c4e.zip
Merge branch 'development' into extractDocs
* development: Added base-contract package to README Update yarn.lock Improve README Feedback README on derivation path Use our dev seed derivation path. README Add ledger-node package as optional dependency Force shouldGetChainCode to true in types Nuke tests for now Remove old ledger Update ledgerco packages Remove only Fix a typo Add PR name Improve an error message when an inorrect number of constructor params is passed
Diffstat (limited to 'packages/deployer/src')
-rw-r--r--packages/deployer/src/deployer.ts14
1 files changed, 13 insertions, 1 deletions
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);