Class: Etherlite::Contract::EventBase

Inherits:
Object
  • Object
show all
Defined in:
lib/etherlite/contract/event_base.rb,
lib/etherlite/commands/contract/event_base/decode_log_inputs.rb

Defined Under Namespace

Classes: DecodeLogInputs

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_block_number, _tx_hash, _attributes) ⇒ EventBase

Returns a new instance of EventBase.



30
31
32
33
34
# File 'lib/etherlite/contract/event_base.rb', line 30

def initialize(_block_number, _tx_hash, _attributes)
  @block_number = _block_number
  @tx_hash = _tx_hash
  @attributes = _attributes
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



28
29
30
# File 'lib/etherlite/contract/event_base.rb', line 28

def attributes
  @attributes
end

#block_numberObject (readonly)

Returns the value of attribute block_number.



28
29
30
# File 'lib/etherlite/contract/event_base.rb', line 28

def block_number
  @block_number
end

#tx_hashObject (readonly)

Returns the value of attribute tx_hash.



28
29
30
# File 'lib/etherlite/contract/event_base.rb', line 28

def tx_hash
  @tx_hash
end

Class Method Details

.decode(_connection, _json) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/etherlite/contract/event_base.rb', line 20

def self.decode(_connection, _json)
  new(
    _json['blockNumber'].nil? ? nil : Etherlite::Utils.hex_to_uint(_json['blockNumber']),
    _json['transactionHash'],
    DecodeLogInputs.for(connection: _connection, inputs: inputs, json: _json)
  )
end

.inputsObject



5
6
7
# File 'lib/etherlite/contract/event_base.rb', line 5

def self.inputs
  nil # To be implemented by sub classes
end

.original_nameObject



9
10
11
# File 'lib/etherlite/contract/event_base.rb', line 9

def self.original_name
  nil # To be implemented by sub classes
end

.signatureObject



13
14
15
16
17
18
# File 'lib/etherlite/contract/event_base.rb', line 13

def self.signature
  @signature ||= begin
    input_sig = inputs.map { |i| i.type.signature }
    "#{original_name}(#{input_sig.join(',')})"
  end
end