trim evm versions in the list

pull/1964/head
Victor Baranov 6 years ago
parent 8866c1bef1
commit 2d5f29f7f3
  1. 1
      apps/explorer/lib/explorer/smart_contract/solidity/code_compiler.ex
  2. 5
      apps/explorer/test/explorer/smart_contract/solidity/code_compiler_test.exs

@ -128,6 +128,7 @@ defmodule Explorer.SmartContract.Solidity.CodeCompiler do
:explorer
|> Application.get_env(:allowed_evm_versions)
|> String.split(",")
|> Enum.map(fn version -> String.trim(version) end)
end
def get_contract_info(contracts, _) when contracts == %{}, do: {:error, :compilation}

@ -278,13 +278,14 @@ defmodule Explorer.SmartContract.Solidity.CodeCompilerTest do
Application.put_env(:explorer, :allowed_evm_versions, @allowed_evm_versions_pattern)
response = CodeCompiler.allowed_evm_versions()
assert response = ["CustomEVM1", "CustomEVM2", "CustomEVM3"]
assert ["CustomEVM1", "CustomEVM2", "CustomEVM3"] = response
end
test "returns default_allowed_evm_versions" do
Application.put_env(:explorer, :allowed_evm_versions, @allowed_evm_versions_default)
response = CodeCompiler.allowed_evm_versions()
assert response = ["homestead", "tangerineWhistle", "spuriousDragon", "byzantium", "constantinople", "petersburg"]
assert ["homestead", "tangerineWhistle", "spuriousDragon", "byzantium", "constantinople", "petersburg"] = response
end
end

Loading…
Cancel
Save