Class: Eth::Abi::Event::LogDescription

Inherits:
Object
  • Object
show all
Defined in:
lib/eth/abi/event.rb

Overview

A decoded event log.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event_interface, log) ⇒ LogDescription

Decodes event log argument values.

Parameters:

  • event_interface (Hash)

    event ABI type.

  • log (Hash)

    transaction receipt log



79
80
81
82
83
84
85
86
87
88
89
# File 'lib/eth/abi/event.rb', line 79

def initialize(event_interface, log)
  @event_interface = event_interface

  inputs = event_interface.fetch("inputs")
  data = log.fetch("data")
  topics = log.fetch("topics", [])
  anonymous = event_interface.fetch("anonymous", false)

  @topic = topics[0] if !anonymous
  @args, @kwargs = Event.decode_log(inputs, data, topics, anonymous)
end

Instance Attribute Details

#argsObject

The the input argument of the event.



67
68
69
# File 'lib/eth/abi/event.rb', line 67

def args
  @args
end

#event_interfaceObject

The event ABI interface used to decode the log.



64
65
66
# File 'lib/eth/abi/event.rb', line 64

def event_interface
  @event_interface
end

#kwargsObject

The named input argument of the event.



70
71
72
# File 'lib/eth/abi/event.rb', line 70

def kwargs
  @kwargs
end

#topicObject

The topic hash.



73
74
75
# File 'lib/eth/abi/event.rb', line 73

def topic
  @topic
end

Instance Method Details

#nameObject

The event name. (e.g. Transfer)



92
93
94
# File 'lib/eth/abi/event.rb', line 92

def name
  @name ||= event_interface.fetch("name")
end

#signatureObject

The event signature. (e.g. Transfer(address,address,uint256))



97
98
99
# File 'lib/eth/abi/event.rb', line 97

def signature
  @signature ||= Abi::Event.signature(event_interface)
end