Class: Coinbase::ContractEvent

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

Overview

Represents a single contract event

Instance Method Summary collapse

Constructor Details

#initialize(model) ⇒ ContractEvent

Returns a new ContractEvent object.

Parameters:



8
9
10
# File 'lib/coinbase/contract_event.rb', line 8

def initialize(model)
  @model = model
end

Instance Method Details

#block_heightInteger

Returns the block height of the ContractEvent.

Returns:

  • (Integer)

    The block height



62
63
64
# File 'lib/coinbase/contract_event.rb', line 62

def block_height
  @model.block_height
end

#block_timeTime

Returns the block time of the ContractEvent.

Returns:

  • (Time)

    The block time



56
57
58
# File 'lib/coinbase/contract_event.rb', line 56

def block_time
  Time.parse(@model.block_time)
end

#contract_addressString

Returns the contract address of the ContractEvent.

Returns:

  • (String)

    The contract address



50
51
52
# File 'lib/coinbase/contract_event.rb', line 50

def contract_address
  @model.contract_address
end

#contract_nameString

Returns the contract name of the ContractEvent.

Returns:

  • (String)

    The contract name



26
27
28
# File 'lib/coinbase/contract_event.rb', line 26

def contract_name
  @model.contract_name
end

#dataString

Returns the event data of the ContractEvent.

Returns:

  • (String)

    The event data



86
87
88
# File 'lib/coinbase/contract_event.rb', line 86

def data
  @model.data
end

#event_indexInteger

Returns the event index of the ContractEvent.

Returns:

  • (Integer)

    The event index



80
81
82
# File 'lib/coinbase/contract_event.rb', line 80

def event_index
  @model.event_index
end

#event_nameString

Returns the event name of the ContractEvent.

Returns:

  • (String)

    The event name



32
33
34
# File 'lib/coinbase/contract_event.rb', line 32

def event_name
  @model.event_name
end

#four_bytesString

Returns the four bytes of the Keccak hash of the event signature.

Returns:

  • (String)

    The four bytes of the event signature hash



44
45
46
# File 'lib/coinbase/contract_event.rb', line 44

def four_bytes
  @model.four_bytes
end

#inspectString

Same as to_s.

Returns:

  • (String)

    a string representation of the ContractEvent



100
101
102
# File 'lib/coinbase/contract_event.rb', line 100

def inspect
  to_s
end

#network_idString

Returns the network ID of the ContractEvent.

Returns:

  • (String)

    The network ID



14
15
16
# File 'lib/coinbase/contract_event.rb', line 14

def network_id
  @model.network_id
end

#protocol_nameString

Returns the protocol name of the ContractEvent.

Returns:

  • (String)

    The protocol name



20
21
22
# File 'lib/coinbase/contract_event.rb', line 20

def protocol_name
  @model.protocol_name
end

#sigString

Returns the signature of the ContractEvent.

Returns:

  • (String)

    The event signature



38
39
40
# File 'lib/coinbase/contract_event.rb', line 38

def sig
  @model.sig
end

#to_sString

Returns a string representation of the ContractEvent.

Returns:

  • (String)

    a string representation of the ContractEvent



92
93
94
95
96
# File 'lib/coinbase/contract_event.rb', line 92

def to_s
  "Coinbase::ContractEvent{network_id: '#{network_id}', protocol_name: '#{protocol_name}', " \
    "contract_name: '#{contract_name}', event_name: '#{event_name}', contract_address: '#{contract_address}', " \
    "block_height: #{block_height}, tx_hash: '#{tx_hash}', data: '#{data}'}"
end

#tx_hashString

Returns the transaction hash of the ContractEvent.

Returns:

  • (String)

    The transaction hash



68
69
70
# File 'lib/coinbase/contract_event.rb', line 68

def tx_hash
  @model.tx_hash
end

#tx_indexInteger

Returns the transaction index of the ContractEvent.

Returns:

  • (Integer)

    The transaction index



74
75
76
# File 'lib/coinbase/contract_event.rb', line 74

def tx_index
  @model.tx_index
end