Class: Ethereum::ContractEvent

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ ContractEvent

Returns a new instance of ContractEvent.



6
7
8
9
10
11
12
13
# File 'lib/ethereum/contract_event.rb', line 6

def initialize(data)
  @name = data["name"]
  @input_types = data["inputs"].collect {|x| x["type"]}
  @inputs = data["inputs"].collect {|x| x["name"]}
  @event_string = "#{@name}(#{@input_types.join(",")})"
  @signature = SHA3::Digest::SHA256.hexdigest(@event_string)
  # @signature = Digest::SHA3.hexdigest @event_string, 256
end

Instance Attribute Details

#addressObject

Returns the value of attribute address.



4
5
6
# File 'lib/ethereum/contract_event.rb', line 4

def address
  @address
end

#clientObject

Returns the value of attribute client.



4
5
6
# File 'lib/ethereum/contract_event.rb', line 4

def client
  @client
end

#event_stringObject

Returns the value of attribute event_string.



4
5
6
# File 'lib/ethereum/contract_event.rb', line 4

def event_string
  @event_string
end

#input_typesObject

Returns the value of attribute input_types.



4
5
6
# File 'lib/ethereum/contract_event.rb', line 4

def input_types
  @input_types
end

#inputsObject

Returns the value of attribute inputs.



4
5
6
# File 'lib/ethereum/contract_event.rb', line 4

def inputs
  @inputs
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/ethereum/contract_event.rb', line 4

def name
  @name
end

#signatureObject

Returns the value of attribute signature.



4
5
6
# File 'lib/ethereum/contract_event.rb', line 4

def signature
  @signature
end

Instance Method Details

#set_address(address) ⇒ Object



15
16
17
# File 'lib/ethereum/contract_event.rb', line 15

def set_address(address)
  @address = address
end

#set_client(client) ⇒ Object



19
20
21
# File 'lib/ethereum/contract_event.rb', line 19

def set_client(client)
  @client = client
end