Class: EvmClient::Initializer

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#clientObject

Returns the value of attribute client.



4
5
6
# File 'lib/evm_client/initializer.rb', line 4

def client
  @client
end

#contractsObject

Returns the value of attribute contracts.



4
5
6
# File 'lib/evm_client/initializer.rb', line 4

def contracts
  @contracts
end

#fileObject

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_allObject



20
21
22
23
24
# File 'lib/evm_client/initializer.rb', line 20

def build_all
  @contracts.each do |contract|
    contract.build
  end
end