Class: EvmClient::Initializer
- Inherits:
-
Object
- Object
- EvmClient::Initializer
- Defined in:
- lib/evm_client/initializer.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
-
#contracts ⇒ Object
Returns the value of attribute contracts.
-
#file ⇒ Object
Returns the value of attribute file.
Instance Method Summary collapse
- #build_all ⇒ Object
-
#initialize(file, client = EvmClient::Singleton.instance) ⇒ Initializer
constructor
A new instance of Initializer.
Constructor Details
#initialize(file, client = EvmClient::Singleton.instance) ⇒ Initializer
Returns a new instance of Initializer.
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/evm_client/initializer.rb', line 6 def initialize(file, client = EvmClient::Singleton.instance) @client = client sol_output = Solidity.new.compile(file) contracts = sol_output.keys @contracts = [] contracts.each do |contract| abi = JSON.parse(sol_output[contract]["abi"] ) name = contract code = sol_output[contract]["bin"] @contracts << Contract.new(name, code, abi, @client) end end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
4 5 6 |
# File 'lib/evm_client/initializer.rb', line 4 def client @client end |
#contracts ⇒ Object
Returns the value of attribute contracts.
4 5 6 |
# File 'lib/evm_client/initializer.rb', line 4 def contracts @contracts end |
#file ⇒ Object
Returns the value of attribute file.
4 5 6 |
# File 'lib/evm_client/initializer.rb', line 4 def file @file end |
Instance Method Details
#build_all ⇒ Object
20 21 22 23 24 |
# File 'lib/evm_client/initializer.rb', line 20 def build_all @contracts.each do |contract| contract.build end end |