Class: Ethlite::Contract
- Inherits:
-
Object
show all
- Defined in:
- lib/ethlite/contract.rb
Direct Known Subclasses
MadCamels, Marcs, Moonbirds, Mooncats, Nouns, NounsAuctionHouse, NounsDescriptor, NounsDescriptorV2, NounsSeeder, PhunksV2, PunkBlocks, PunksData, PunksMeta, PunksV1, SynthNouns, SynthPunks
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(address = self.class.default_address) ⇒ Contract
Returns a new instance of Contract.
37
38
39
|
# File 'lib/ethlite/contract.rb', line 37
def initialize( address = self.class.default_address )
@address = address
end
|
Class Method Details
.address(address) ⇒ Object
28
29
30
31
|
# File 'lib/ethlite/contract.rb', line 28
def self.address( address )
@address = address
@address
end
|
.at(address) ⇒ Object
8
9
10
11
|
# File 'lib/ethlite/contract.rb', line 8
def self.at( address )
puts " creating new contract #{self.name} @ #{address}"
new( address )
end
|
.default_address ⇒ Object
33
34
35
|
# File 'lib/ethlite/contract.rb', line 33
def self.default_address()
defined?( @address ) ? @address : nil
end
|
.methods ⇒ Object
21
22
23
24
|
# File 'lib/ethlite/contract.rb', line 21
def self.methods()
@methods ||= {}
@methods
end
|
.sig(name, inputs: [], outputs: []) ⇒ Object
14
15
16
17
18
19
20
|
# File 'lib/ethlite/contract.rb', line 14
def self.sig( name, inputs: [], outputs: [] )
@methods ||= {}
@methods[ name ] = ContractMethod.new( name,
inputs: inputs,
outputs: outputs )
@methods
end
|
Instance Method Details
#do_call(name, *args) ⇒ Object
42
43
44
45
46
47
48
|
# File 'lib/ethlite/contract.rb', line 42
def do_call( name, *args )
puts "==> calling #{self.class.name}##{name} with args:"
pp args
method = self.class.methods[ name ]
method.do_call( Ethlite.config.rpc, @address, args )
end
|