aboutsummaryrefslogtreecommitdiffstats
path: root/packages/deployer/src
diff options
context:
space:
mode:
authorGreg Hysen <greg.hysen@gmail.com>2018-04-10 02:55:23 +0800
committerGreg Hysen <greg.hysen@gmail.com>2018-04-10 10:25:07 +0800
commiteecf09f51564df4f63139f26e65efa1102a9958d (patch)
tree2ab49214ca5f1aef196d1899de8091908feabb82 /packages/deployer/src
parent61fc3346c2fe2adc33dfe84aa50780d61e10efdf (diff)
downloaddexon-sol-tools-eecf09f51564df4f63139f26e65efa1102a9958d.tar
dexon-sol-tools-eecf09f51564df4f63139f26e65efa1102a9958d.tar.gz
dexon-sol-tools-eecf09f51564df4f63139f26e65efa1102a9958d.tar.bz2
dexon-sol-tools-eecf09f51564df4f63139f26e65efa1102a9958d.tar.lz
dexon-sol-tools-eecf09f51564df4f63139f26e65efa1102a9958d.tar.xz
dexon-sol-tools-eecf09f51564df4f63139f26e65efa1102a9958d.tar.zst
dexon-sol-tools-eecf09f51564df4f63139f26e65efa1102a9958d.zip
Added a detailed description of `renameOverloadedMethods` (special thanks to @fabioberger). Updated Javascript styles in the Abi-Gen and Utils packages, around support for function overloading.
Diffstat (limited to 'packages/deployer/src')
-rw-r--r--packages/deployer/src/cli.ts2
-rw-r--r--packages/deployer/src/compiler.ts17
-rw-r--r--packages/deployer/src/utils/types.ts2
3 files changed, 13 insertions, 8 deletions
diff --git a/packages/deployer/src/cli.ts b/packages/deployer/src/cli.ts
index 3d69925a8..62afe0d4c 100644
--- a/packages/deployer/src/cli.ts
+++ b/packages/deployer/src/cli.ts
@@ -45,7 +45,7 @@ async function onDeployCommandAsync(argv: CliOptions): Promise<void> {
const web3Wrapper = new Web3Wrapper(web3Provider);
const networkId = await web3Wrapper.getNetworkIdAsync();
const compilerOpts: CompilerOptions = {
- contractDirs: getContractDirectoriesFromList(argv.contractsDir),
+ contractDirs: getContractDirectoriesFromList(argv.contractDirs),
networkId,
optimizerEnabled: argv.shouldOptimize,
artifactsDir: argv.artifactsDir,
diff --git a/packages/deployer/src/compiler.ts b/packages/deployer/src/compiler.ts
index beaaab141..e3ecc6c72 100644
--- a/packages/deployer/src/compiler.ts
+++ b/packages/deployer/src/compiler.ts
@@ -26,7 +26,7 @@ import {
CompilerOptions,
ContractArtifact,
ContractDirectory,
- ContractIds,
+ ContractIdToSourceFileId,
ContractNetworkData,
ContractNetworks,
ContractSourceDataByFileId,
@@ -75,6 +75,9 @@ export class Compiler {
encoding: 'utf8',
};
const source = await fsWrapper.readFileAsync(contentPath, opts);
+ if (!_.startsWith(contentPath, contractBaseDir)) {
+ throw new Error(`Expected content path '${contentPath}' to begin with '${contractBaseDir}'`);
+ }
const sourceFilePath = contentPath.slice(contractBaseDir.length);
sources[sourceFilePath] = source;
logUtils.log(`Reading ${sourceFilePath} source...`);
@@ -114,7 +117,7 @@ export class Compiler {
await createDirIfDoesNotExistAsync(this._artifactsDir);
await createDirIfDoesNotExistAsync(SOLC_BIN_DIR);
this._contractSources = {};
- const contractIds: ContractIds = {};
+ const contractIdToSourceFileId: ContractIdToSourceFileId = {};
const contractDirs = Array.from(this._contractDirs.values());
for (const contractDir of contractDirs) {
const sources = await Compiler._getContractSourcesAsync(contractDir.path, contractDir.path);
@@ -127,18 +130,20 @@ export class Compiler {
this._contractSources[sourceFileId] = source;
// Create a mapping between the contract id and its source file id
const contractId = constructContractId(contractDir.namespace, sourceFilePath);
- if (!_.isUndefined(contractIds[contractId])) {
+ if (!_.isUndefined(contractIdToSourceFileId[contractId])) {
throw new Error(`Found duplicate contract with ID '${contractId}'`);
}
- contractIds[contractId] = sourceFileId;
+ contractIdToSourceFileId[contractId] = sourceFileId;
});
}
_.forIn(this._contractSources, this._setContractSpecificSourceData.bind(this));
const specifiedContractIds = this._specifiedContracts.has(ALL_CONTRACTS_IDENTIFIER)
- ? _.keys(contractIds)
+ ? _.keys(contractIdToSourceFileId)
: Array.from(this._specifiedContracts.values());
await Promise.all(
- _.map(specifiedContractIds, async contractId => this._compileContractAsync(contractIds[contractId])),
+ _.map(specifiedContractIds, async contractId =>
+ this._compileContractAsync(contractIdToSourceFileId[contractId]),
+ ),
);
}
/**
diff --git a/packages/deployer/src/utils/types.ts b/packages/deployer/src/utils/types.ts
index 08cab37b2..1a866b873 100644
--- a/packages/deployer/src/utils/types.ts
+++ b/packages/deployer/src/utils/types.ts
@@ -83,7 +83,7 @@ export interface ContractSources {
[key: string]: string;
}
-export interface ContractIds {
+export interface ContractIdToSourceFileId {
[key: string]: string;
}