Skip to content

Commit

Permalink
style: abandon the confusing clauses to Deployer.create_new for modules
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotr Dobaczewski Imapp committed Oct 4, 2019
1 parent 9a250e8 commit ff52cac
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ defmodule OMG.DependencyConformance.SignatureTest do
{:ok, [addr | _]} = Ethereumex.HttpClient.eth_accounts()

{:ok, _, signtest_addr} =
Eth.Deployer.create_new(OMG.Eth.PaymentEip712LibMock, root_path, Eth.Encoding.from_hex(addr), [])
Eth.Deployer.create_new("PaymentEip712LibMock", root_path, Eth.Encoding.from_hex(addr), [])

# impose our testing signature contract wrapper (mock) as the validating contract, which normally would be
# plasma framework
Expand Down
2 changes: 1 addition & 1 deletion apps/omg_eth/test/fixtures.exs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ defmodule OMG.Eth.Fixtures do
root_path = Application.fetch_env!(:omg_eth, :umbrella_root_dir)
{:ok, [addr | _]} = Ethereumex.HttpClient.eth_accounts()

{:ok, _, token_addr} = Eth.Deployer.create_new(OMG.Eth.Token, root_path, Encoding.from_hex(addr), [])
{:ok, _, token_addr} = Eth.Deployer.create_new("ERC20Mintable", root_path, Encoding.from_hex(addr), [])

# ensuring that the root chain contract handles token_addr
{:ok, false} = Eth.RootChainHelper.has_token(token_addr)
Expand Down
15 changes: 0 additions & 15 deletions apps/omg_eth/test/support/deployer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,6 @@ defmodule OMG.Eth.Deployer do

def create_new(contract, path_project_root, from, args, opts \\ [])

# special case so that we have a civil name for the Token contract
def create_new(OMG.Eth.Token, path_project_root, from, [], opts) do
gas = Map.get(@gas_contracts, "ERC20Mintable", @gas_contract_rootchain)

get_bytecode!(path_project_root, "ERC20Mintable")
|> deploy_contract(from, gas, opts)
end

def create_new(OMG.Eth.PaymentEip712LibMock, path_project_root, from, [], opts) do
gas = Map.get(@gas_contracts, "PaymentEip712LibMock", @gas_contract_rootchain)

get_bytecode!(path_project_root, "PaymentEip712LibMock")
|> deploy_contract(from, gas, opts)
end

# common case for no-argument deployments
def create_new(contract_module_name, path_project_root, from, [], opts) when is_binary(contract_module_name) do
contract_name = contract_module_name |> to_string() |> String.split(".") |> List.last()
Expand Down

0 comments on commit ff52cac

Please sign in to comment.