Class: ABI::Contract
- Inherits:
-
Object
- Object
- ABI::Contract
- Defined in:
- lib/abi2sol/generate.rb
Instance Method Summary collapse
-
#generate_interface(name:) ⇒ Object
interface declarations.
Instance Method Details
#generate_interface(name:) ⇒ Object
interface declarations
6 7 8 9 10 11 12 13 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 53 |
# File 'lib/abi2sol/generate.rb', line 6 def generate_interface( name: ) ## interface declarations buf = '' buf << "interface #{name} {" # include constructor - why? why not? # # if @ctor # buf << "\n" # buf << "// Constructor\n" # buf << "#{@ctor.decl}\n" # end if payable_functions.size > 0 buf << "\n" buf << "// #{payable_functions.size} Payable Function(s)\n" payable_functions.each do |func| buf << "#{func.decl}\n" end end if transact_functions.size > 0 buf << "\n" buf << "// #{transact_functions.size} Transact Functions(s)\n" transact_functions.each do |func| buf << "#{func.decl}\n" end end if query_functions.size > 0 buf << "\n" buf << "// #{query_functions.size} Query Functions(s)\n" query_functions.each do |func| buf << "#{func.decl}\n" end end if helper_functions.size > 0 buf << "\n" buf << "// #{helper_functions.size} Helper Functions(s)\n\n" helper_functions.each do |func| buf << "#{func.decl}\n" end end buf << "}\n" buf end |