|
|
@ -2586,6 +2586,32 @@ defmodule Explorer.ChainTest do |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
describe "create_decompiled_smart_contract/1" do |
|
|
|
|
|
|
|
test "with valid params creates decompiled smart contract" do |
|
|
|
|
|
|
|
address_hash = to_string(insert(:address).hash) |
|
|
|
|
|
|
|
decompiler_version = "test_decompiler" |
|
|
|
|
|
|
|
decompiled_source_code = "hello world" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
params = %{ |
|
|
|
|
|
|
|
address_hash: address_hash, |
|
|
|
|
|
|
|
decompiler_version: decompiler_version, |
|
|
|
|
|
|
|
decompiled_source_code: decompiled_source_code |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{:ok, decompiled_smart_contract} = Chain.create_decompiled_smart_contract(params) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert decompiled_smart_contract.decompiler_version == decompiler_version |
|
|
|
|
|
|
|
assert decompiled_smart_contract.decompiled_source_code == decompiled_source_code |
|
|
|
|
|
|
|
assert address_hash == to_string(decompiled_smart_contract.address_hash) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test "with invalid params can't create decompiled smart contract" do |
|
|
|
|
|
|
|
params = %{code: "cat"} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{:error, _changeset} = Chain.create_decompiled_smart_contract(params) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
describe "create_smart_contract/1" do |
|
|
|
describe "create_smart_contract/1" do |
|
|
|
setup do |
|
|
|
setup do |
|
|
|
smart_contract_bytecode = |
|
|
|
smart_contract_bytecode = |
|
|
|