Class: Etheruby::Encoders::Function
- Inherits:
-
Base
- Object
- Base
- Etheruby::Encoders::Function
show all
- Defined in:
- lib/etheruby/encoders/function.rb
Instance Attribute Summary
Attributes inherited from Base
#data
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Instance Method Details
#decode ⇒ Object
12
13
14
15
16
17
18
|
# File 'lib/etheruby/encoders/function.rb', line 12
def decode
address, selector = data[0..39], data[40..47]
return {
address: Address.new(address).decode[0],
selector: "0x#{selector}"
}, 32
end
|
#encode ⇒ Object
8
9
10
|
# File 'lib/etheruby/encoders/function.rb', line 8
def encode
(data[:address].to_s(16) + data[:selector].to_s(16)).ljust(64, '0')
end
|
#to_s ⇒ Object
20
21
22
|
# File 'lib/etheruby/encoders/function.rb', line 20
def to_s
encode
end
|