Class: Abi2Sol::Tool

Inherits:
Object
  • Object
show all
Defined in:
lib/abi2sol.rb

Class Method Summary collapse

Class Method Details

.do_generate(path, name:) ⇒ Object



56
57
58
59
60
61
62
63
64
65
# File 'lib/abi2sol.rb', line 56

def self.do_generate( path, name:  )
  abi = ABI.read( path )
  ## pp abi

  puts "==> generate contract interface from abi in (#{path})..."

  buf =  abi.generate_interface( name: name )
  puts buf
  ## write_text( "./tmp/punks_v1.sol", buf )
end

.main(args = ARGV) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/abi2sol.rb', line 14

def self.main( args=ARGV )
  puts "==> welcome to abi2parse tool with args:"
  pp args

  options = {
            }

  parser = OptionParser.new do |opts|

    opts.on("--name STRING",
            "name of contract interface (default: nil)") do |str|
        options[ :name]  = str
    end

    opts.on("-h", "--help", "Prints this help") do
      puts opts
      exit
    end
  end

  parser.parse!( args )
  puts "options:"
  pp options

  puts "args:"
  pp args

  if args.size < 1
    puts "!! ERROR - no contract found - use <contract>"
    puts ""
    exit
  end

  path = args[0]

  do_generate( path, name: options[:name] )

  puts "bye"
end