diff --git a/apps/explorer/lib/explorer/smart_contract/solidity/code_compiler.ex b/apps/explorer/lib/explorer/smart_contract/solidity/code_compiler.ex index 6127053585..e7f6090707 100644 --- a/apps/explorer/lib/explorer/smart_contract/solidity/code_compiler.ex +++ b/apps/explorer/lib/explorer/smart_contract/solidity/code_compiler.ex @@ -66,7 +66,7 @@ defmodule Explorer.SmartContract.Solidity.CodeCompiler do compiler_version = Keyword.fetch!(params, :compiler_version) code = Keyword.fetch!(params, :code) optimize = Keyword.fetch!(params, :optimize) - _optimization_runs = Keyword.get(params, :optimization_runs, 200) + optimization_runs = params |> Keyword.get(:optimization_runs, 200) |> Integer.to_string() evm_version = Keyword.get(params, :evm_version, List.last(@allowed_evm_versions)) external_libs = Keyword.get(params, :external_libs, %{}) @@ -87,6 +87,7 @@ defmodule Explorer.SmartContract.Solidity.CodeCompiler do code, compiler_version, optimize_value(optimize), + optimization_runs, @new_contract_name, external_libs_string, checked_evm_version diff --git a/apps/explorer/priv/compile_solc.js b/apps/explorer/priv/compile_solc.js index 2ed0ff2664..6e9489d433 100755 --- a/apps/explorer/priv/compile_solc.js +++ b/apps/explorer/priv/compile_solc.js @@ -5,9 +5,10 @@ const solc = require('solc'); var sourceCode = process.argv[2]; var version = process.argv[3]; var optimize = process.argv[4]; -var newContractName = process.argv[5]; -var externalLibraries = JSON.parse(process.argv[6]) -var evmVersion = process.argv[7] +var optimizationRuns = parseInt(process.argv[5], 10); +var newContractName = process.argv[6]; +var externalLibraries = JSON.parse(process.argv[7]) +var evmVersion = process.argv[8]; var compiled_code = solc.loadRemoteVersion(version, function (err, solcSnapshot) { if (err) { @@ -24,7 +25,7 @@ var compiled_code = solc.loadRemoteVersion(version, function (err, solcSnapshot) evmVersion: evmVersion, optimizer: { enabled: optimize == '1', - runs: 200 + runs: optimizationRuns }, libraries: { [newContractName]: externalLibraries