Class: Voucher::ElectionContract
- Inherits:
-
Object
- Object
- Voucher::ElectionContract
- Defined in:
- lib/voucher/election_contract.rb
Instance Attribute Summary collapse
-
#contract ⇒ Object
readonly
Returns the value of attribute contract.
-
#ethereum ⇒ Object
readonly
Returns the value of attribute ethereum.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ ElectionContract
constructor
A new instance of ElectionContract.
- #winning_hash(shard) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ ElectionContract
Returns a new instance of ElectionContract.
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/voucher/election_contract.rb', line 7 def initialize( = {}) @ethereum = Ethereum::HttpClient.new([:ethereum_url]) @contract = Ethereum::Contract.create( name: [:name] || 'ElectionContractClient', address: [:address], abi: [:abi], client: ethereum ) @roots = {} @formatter = Ethereum::Formatter.new end |
Instance Attribute Details
#contract ⇒ Object (readonly)
Returns the value of attribute contract.
5 6 7 |
# File 'lib/voucher/election_contract.rb', line 5 def contract @contract end |
#ethereum ⇒ Object (readonly)
Returns the value of attribute ethereum.
5 6 7 |
# File 'lib/voucher/election_contract.rb', line 5 def ethereum @ethereum end |
Instance Method Details
#winning_hash(shard) ⇒ Object
21 22 23 |
# File 'lib/voucher/election_contract.rb', line 21 def winning_hash(shard) @roots[shard] ||= find_root(shard) end |