Add a check for compiler output

This commit is contained in:
Leonid Logvinov
2018-05-10 15:09:33 +02:00
parent 62f1430a2c
commit a5fea3b9c3
3 changed files with 4 additions and 2 deletions

View File

@@ -13,6 +13,6 @@ before('migrate contracts', async function() {
gas: devConstants.GAS_ESTIMATE,
from: devConstants.TESTRPC_FIRST_ADDRESS,
};
const artifactsDir = `../migrations/artifacts/${constants.ARTIFACTS_VERSION}`;
const artifactsDir = `../migrations/artifacts/1.0.0`;
await runMigrationsAsync(provider, artifactsDir, defaults);
});

View File

@@ -6,5 +6,4 @@ export const constants = {
KOVAN_RPC_URL: 'https://kovan.infura.io/',
ROPSTEN_RPC_URL: 'https://ropsten.infura.io/',
ZRX_DECIMALS: 18,
ARTIFACTS_VERSION: '1.0.0',
};

View File

@@ -46,6 +46,9 @@ export class {{contractName}}Contract extends BaseContract {
defaults: Partial<TxData>,
{{> typed_params inputs=ctor.inputs}}
): Promise<{{contractName}}Contract> {
if (_.isUndefined(artifact.compilerOutput)) {
throw new Error('Compiler output not found in the artifact file');
}
const bytecode = artifact.compilerOutput.evm.bytecode.object;
const abi = artifact.compilerOutput.abi;
return {{contractName}}Contract.deployAsync(bytecode, abi, provider, defaults, {{> params inputs=ctor.inputs}});