Class: ArtQ::Contract

Inherits:
Object
  • Object
show all
Defined in:
lib/artq/contract.rb

Constant Summary collapse

METHODS =

auto-add “well-known” methods for contract methods - why? why not?

{
  name: { inputs: [],
          outputs: ['string'] },
  symbol: { inputs: [],
            outputs: ['string'] },
  totalSupply: { inputs: [],
                 outputs: ['uint256'] },
  tokenURI: { inputs: ['uint256'],
              outputs: ['string'] },

  traitData: { inputs: ['uint256', 'uint256'],
               outputs: ['string'] },
  traitDetails: { inputs: ['uint256', 'uint256'],
                  outputs: ['(string,string,bool)'] },
}

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(contract_address) ⇒ Contract

Returns a new instance of Contract.



61
62
63
# File 'lib/artq/contract.rb', line 61

def initialize( contract_address )
   @contract_address = contract_address
end

Class Method Details

.rpcObject

note: forward to Ethlite.config.rpc

keep config here as a convenience shortcut - why? why not?


55
# File 'lib/artq/contract.rb', line 55

def self.rpc()        Ethlite.config.rpc; end

.rpc=(value) ⇒ Object



56
# File 'lib/artq/contract.rb', line 56

def self.rpc=(value)  Ethlite.config.rpc = value; end

Instance Method Details

#_do_call(eth, args) ⇒ Object

private helper to call method



67
68
69
70
# File 'lib/artq/contract.rb', line 67

def _do_call( eth, args )
  puts "  calling method >#{eth.name}< with args >#{args}<... "
  eth.do_call( self.class.rpc, @contract_address, args )
end