|
|
|
@ -100,6 +100,34 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do |
|
|
|
|
] |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
test "filtering for only unverified contracts does not show self destructed contracts", %{ |
|
|
|
|
params: params, |
|
|
|
|
conn: conn |
|
|
|
|
} do |
|
|
|
|
address = insert(:contract_address) |
|
|
|
|
insert(:smart_contract) |
|
|
|
|
insert(:contract_address, contract_code: "0x") |
|
|
|
|
|
|
|
|
|
response = |
|
|
|
|
conn |
|
|
|
|
|> get("/api", Map.put(params, "filter", "unverified")) |
|
|
|
|
|> json_response(200) |
|
|
|
|
|
|
|
|
|
assert response["message"] == "OK" |
|
|
|
|
assert response["status"] == "1" |
|
|
|
|
|
|
|
|
|
assert response["result"] == [ |
|
|
|
|
%{ |
|
|
|
|
"ABI" => "Contract source code not verified", |
|
|
|
|
"Address" => to_string(address.hash), |
|
|
|
|
"CompilerVersion" => "", |
|
|
|
|
"ContractName" => "", |
|
|
|
|
"DecompilerVersion" => "", |
|
|
|
|
"OptimizationUsed" => "" |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
test "filtering for only verified contracts shows only verified contracts", %{params: params, conn: conn} do |
|
|
|
|
insert(:contract_address) |
|
|
|
|
contract = insert(:smart_contract) |
|
|
|
@ -222,6 +250,35 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
test "filtering for only not_decompiled (and by extension not verified contracts) does not show empty contracts", %{ |
|
|
|
|
params: params, |
|
|
|
|
conn: conn |
|
|
|
|
} do |
|
|
|
|
insert(:decompiled_smart_contract) |
|
|
|
|
insert(:smart_contract) |
|
|
|
|
insert(:contract_address, contract_code: "0x") |
|
|
|
|
contract_address = insert(:contract_address) |
|
|
|
|
|
|
|
|
|
response = |
|
|
|
|
conn |
|
|
|
|
|> get("/api", Map.put(params, "filter", "not_decompiled")) |
|
|
|
|
|> json_response(200) |
|
|
|
|
|
|
|
|
|
assert response["message"] == "OK" |
|
|
|
|
assert response["status"] == "1" |
|
|
|
|
|
|
|
|
|
assert response["result"] == [ |
|
|
|
|
%{ |
|
|
|
|
"ABI" => "Contract source code not verified", |
|
|
|
|
"Address" => to_string(contract_address.hash), |
|
|
|
|
"CompilerVersion" => "", |
|
|
|
|
"ContractName" => "", |
|
|
|
|
"DecompilerVersion" => "", |
|
|
|
|
"OptimizationUsed" => "" |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
describe "getabi" do |
|
|
|
|