aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-03-16 18:09:12 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-03-21 22:11:41 +0800
commit439e8640859cf790bac51c1beeec4cf65aa33c57 (patch)
tree9863b39ce23369c97145ee5308545b2b8040a6cf /packages
parentf45191d0e81e3ad3873e78c3891fdd5f9e9fd55c (diff)
downloaddexon-0x-contracts-439e8640859cf790bac51c1beeec4cf65aa33c57.tar.gz
dexon-0x-contracts-439e8640859cf790bac51c1beeec4cf65aa33c57.tar.zst
dexon-0x-contracts-439e8640859cf790bac51c1beeec4cf65aa33c57.zip
Change the type of optimizerEnabled to boolean and convert it to number only before passing to a compiler
Diffstat (limited to 'packages')
-rw-r--r--packages/deployer/src/cli.ts4
-rw-r--r--packages/deployer/src/compiler.ts4
-rw-r--r--packages/deployer/src/utils/types.ts4
-rw-r--r--packages/deployer/test/util/constants.ts2
-rw-r--r--packages/deployer/tsconfig.json3
5 files changed, 8 insertions, 9 deletions
diff --git a/packages/deployer/src/cli.ts b/packages/deployer/src/cli.ts
index 176eaf973..efbf56bb0 100644
--- a/packages/deployer/src/cli.ts
+++ b/packages/deployer/src/cli.ts
@@ -29,7 +29,7 @@ async function onCompileCommandAsync(argv: CliOptions): Promise<void> {
const opts: CompilerOptions = {
contractsDir: argv.contractsDir,
networkId: argv.networkId,
- optimizerEnabled: argv.shouldOptimize ? 1 : 0,
+ optimizerEnabled: argv.shouldOptimize,
artifactsDir: argv.artifactsDir,
specifiedContracts: getContractsSetFromList(argv.contracts),
};
@@ -47,7 +47,7 @@ async function onDeployCommandAsync(argv: CliOptions): Promise<void> {
const compilerOpts: CompilerOptions = {
contractsDir: argv.contractsDir,
networkId,
- optimizerEnabled: argv.shouldOptimize ? 1 : 0,
+ optimizerEnabled: argv.shouldOptimize,
artifactsDir: argv.artifactsDir,
specifiedContracts: getContractsSetFromList(argv.contracts),
};
diff --git a/packages/deployer/src/compiler.ts b/packages/deployer/src/compiler.ts
index 942777458..28232a661 100644
--- a/packages/deployer/src/compiler.ts
+++ b/packages/deployer/src/compiler.ts
@@ -32,7 +32,7 @@ const DEPENDENCY_PATH_REGEX = /"([^"]+)"/; // Source: https://github.com/BlockCh
export class Compiler {
private _contractsDir: string;
private _networkId: number;
- private _optimizerEnabled: number;
+ private _optimizerEnabled: boolean;
private _artifactsDir: string;
private _contractSources?: ContractSources;
private _solcErrors: Set<string> = new Set();
@@ -223,7 +223,7 @@ export class Compiler {
};
const compiled = solcInstance.compile(
sourcesToCompile,
- this._optimizerEnabled,
+ Number(this._optimizerEnabled),
this._findImportsIfSourcesExist.bind(this),
);
diff --git a/packages/deployer/src/utils/types.ts b/packages/deployer/src/utils/types.ts
index f33f8f66a..13b24b9b7 100644
--- a/packages/deployer/src/utils/types.ts
+++ b/packages/deployer/src/utils/types.ts
@@ -20,7 +20,7 @@ export interface ContractNetworks {
export interface ContractNetworkData {
solc_version: string;
- optimizer_enabled: number;
+ optimizer_enabled: boolean;
keccak256: string;
source_tree_hash: string;
abi: Web3.ContractAbi;
@@ -53,7 +53,7 @@ export interface CliOptions extends yargs.Arguments {
export interface CompilerOptions {
contractsDir: string;
networkId: number;
- optimizerEnabled: number;
+ optimizerEnabled: boolean;
artifactsDir: string;
specifiedContracts: Set<string>;
}
diff --git a/packages/deployer/test/util/constants.ts b/packages/deployer/test/util/constants.ts
index 7b6960359..7ba94c1f2 100644
--- a/packages/deployer/test/util/constants.ts
+++ b/packages/deployer/test/util/constants.ts
@@ -3,7 +3,7 @@ import { BigNumber } from '@0xproject/utils';
export const constants = {
networkId: 0,
jsonrpcUrl: 'http://localhost:8545',
- optimizerEnabled: 0,
+ optimizerEnabled: true,
gasPrice: new BigNumber(20000000000),
timeoutMs: 20000,
zrxTokenAddress: '0xe41d2489571d322189246dafa5ebde1f4699f498',
diff --git a/packages/deployer/tsconfig.json b/packages/deployer/tsconfig.json
index 897446b66..befcde5b7 100644
--- a/packages/deployer/tsconfig.json
+++ b/packages/deployer/tsconfig.json
@@ -2,8 +2,7 @@
"extends": "../../tsconfig",
"compilerOptions": {
"outDir": "lib",
- "strictFunctionTypes": false,
- "strictNullChecks": false
+ "strictFunctionTypes": false
},
"include": [
"./src/**/*",