Class: EtherDev::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/ether_dev/cli.rb

Instance Method Summary collapse

Instance Method Details

#deploy(filename, private_key = nil) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/ether_dev/cli.rb', line 4

def deploy(filename, private_key = nil)
  config = YAML.load(File.open("config.yml"))["development"] || {}

  key = ::Eth::Key.new priv: (private_key || config["account_key"])
  client = Ethereum::HttpClient.new(config["rpc"])

  contract = Ethereum::Contract.create(file: "contracts/#{filename}", client: client)
  contract.key = key
  puts "Deploying contract..."
  contract.deploy_and_wait()
  puts "Deployed contract to #{contract.address}"
end

#new(project_name) ⇒ Object



18
19
20
21
22
23
# File 'lib/ether_dev/cli.rb', line 18

def new(project_name)
  require "ether_dev/generators/project_generator"

  generator = ProjectGenerator.new(project_name)
  generator.generate
end