add one more test with external libraries contract

pull/1400/head
Ayrat Badykov 6 years ago
parent 499f3699c7
commit 6c96b04d2f
No known key found for this signature in database
GPG Key ID: B44668E265E9396F
  1. 4
      apps/explorer/lib/explorer/smart_contract/solidity/code_compiler.ex
  2. 2
      apps/explorer/test/support/factory.ex
  3. 2
      apps/explorer/test/support/fixture/smart_contract/compiler_tests.json

@ -55,7 +55,7 @@ defmodule Explorer.SmartContract.Solidity.CodeCompiler do
"type" => "function" "type" => "function"
} }
], ],
"bytecode" => "608060405234801561001057600080fd5b5060df8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a72305820834bdab406d80509618957aa1a5ad1a4b77f4f1149078675940494ebe5b4147b0029", "bytecode" => "6080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a72305820834bdab406d80509618957aa1a5ad1a4b77f4f1149078675940494ebe5b4147b0029",
"name" => "SimpleStorage" "name" => "SimpleStorage"
} }
} }
@ -74,7 +74,7 @@ defmodule Explorer.SmartContract.Solidity.CodeCompiler do
) )
with {:ok, contracts} <- Jason.decode(response), with {:ok, contracts} <- Jason.decode(response),
%{"abi" => abi, "evm" => %{"bytecode" => %{"object" => bytecode}}} <- get_contract_info(contracts, name) do %{"abi" => abi, "evm" => %{"deployedBytecode" => %{"object" => bytecode}}} <- get_contract_info(contracts, name) do
bytecode_with_libraries = add_library_addresses(bytecode, external_libs) bytecode_with_libraries = add_library_addresses(bytecode, external_libs)
{:ok, %{"abi" => abi, "bytecode" => bytecode_with_libraries, "name" => name}} {:ok, %{"abi" => abi, "bytecode" => bytecode_with_libraries, "name" => name}}

@ -75,7 +75,7 @@ defmodule Explorer.Factory do
def contract_code_info do def contract_code_info do
%{ %{
bytecode: bytecode:
"0x608060405234801561001057600080fd5b5060df8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a72305820834bdab406d80509618957aa1a5ad1a4b77f4f1149078675940494ebe5b4147b0029", "0x6080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a72305820f65a3adc1cfb055013d1dc37d0fe98676e2a5963677fa7541a10386d163446680029",
name: "SimpleStorage", name: "SimpleStorage",
source_code: """ source_code: """
pragma solidity ^0.4.24; pragma solidity ^0.4.24;

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save