aboutsummaryrefslogtreecommitdiffstats
path: root/packages/deployer/src
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-03-15 23:30:18 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-03-21 22:07:51 +0800
commit8fd705d2afe6ddcb53a16973256a0674e180be67 (patch)
treefd07c962f98d6cd1fe67568f76e8455c78d82e50 /packages/deployer/src
parent3c36135d6c9c4b4deb1985bd71ba6f4002d16d0e (diff)
downloaddexon-sol-tools-8fd705d2afe6ddcb53a16973256a0674e180be67.tar
dexon-sol-tools-8fd705d2afe6ddcb53a16973256a0674e180be67.tar.gz
dexon-sol-tools-8fd705d2afe6ddcb53a16973256a0674e180be67.tar.bz2
dexon-sol-tools-8fd705d2afe6ddcb53a16973256a0674e180be67.tar.lz
dexon-sol-tools-8fd705d2afe6ddcb53a16973256a0674e180be67.tar.xz
dexon-sol-tools-8fd705d2afe6ddcb53a16973256a0674e180be67.tar.zst
dexon-sol-tools-8fd705d2afe6ddcb53a16973256a0674e180be67.zip
Throw an error if contract file doesn't contain the contract with the same name
Diffstat (limited to 'packages/deployer/src')
-rw-r--r--packages/deployer/src/compiler.ts5
1 files changed, 5 insertions, 0 deletions
diff --git a/packages/deployer/src/compiler.ts b/packages/deployer/src/compiler.ts
index 83977709b..206f333f6 100644
--- a/packages/deployer/src/compiler.ts
+++ b/packages/deployer/src/compiler.ts
@@ -228,6 +228,11 @@ export class Compiler {
}
const contractName = path.basename(fileName, constants.SOLIDITY_FILE_EXTENSION);
const contractIdentifier = `${fileName}:${contractName}`;
+ if (_.isUndefined(compiled.contracts[contractIdentifier])) {
+ throw new Error(
+ `Contract ${contractName} not found in ${fileName}. Please make sure your contract has the same name as a file`,
+ );
+ }
const abi: Web3.ContractAbi = JSON.parse(compiled.contracts[contractIdentifier].interface);
const bytecode = `0x${compiled.contracts[contractIdentifier].bytecode}`;
const runtimeBytecode = `0x${compiled.contracts[contractIdentifier].runtimeBytecode}`;