voucher 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.rubocop.yml +1 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +11 -7
- data/README.md +43 -1
- data/lib/voucher.rb +4 -3
- data/lib/voucher/chain_contract.rb +46 -0
- data/lib/voucher/cli.rb +1 -1
- data/lib/voucher/config.rb +17 -9
- data/lib/voucher/config/json/chain.json +753 -0
- data/lib/voucher/errors.rb +2 -2
- data/lib/voucher/metrics.rb +339 -0
- data/lib/voucher/model/segment.rb +45 -95
- data/lib/voucher/validator.rb +4 -4
- data/lib/voucher/version.rb +1 -1
- data/voucher.gemspec +2 -1
- metadata +21 -6
- data/lib/voucher/config/json/election.json +0 -210
- data/lib/voucher/election_contract.rb +0 -41
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e3b42fe58da21ce169db9f3b3d858c0142f09d5
|
4
|
+
data.tar.gz: 6831ffac983b28322d93f7bee4e3ad120b3d4062
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9227d138f53cba826806f17b8df3eb0e554a27b74df7e9edc32fc34fe29bc20bac154ec4f85f7ea002d679ed5cf85352916264402340fe9f7e2df72b1406b42
|
7
|
+
data.tar.gz: 8bd4a9086af7859c614089285661297e4530a5f55f945d25677405fb3b51ca37258f36a0085c50e4d2ba8dd7af29407254c8601c0bcdcf5d4e61b2a146fe36ba
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
+
## [0.3.0] - 2019-04-11
|
8
|
+
### Added:
|
9
|
+
- advertisement_id on Segment
|
10
|
+
- update validation process
|
11
|
+
|
7
12
|
## [0.2.1] - 2018-10-05
|
8
13
|
### Fixed:
|
9
14
|
- Gem version
|
data/Gemfile.lock
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
voucher (0.
|
4
|
+
voucher (0.3.0)
|
5
5
|
activesupport (~> 5.2)
|
6
6
|
ethereum.rb (~> 2.2)
|
7
7
|
hashtastic
|
8
|
+
mixlib-config
|
8
9
|
murky_waters
|
9
10
|
thor
|
10
11
|
virtus
|
@@ -12,7 +13,7 @@ PATH
|
|
12
13
|
GEM
|
13
14
|
remote: https://rubygems.org/
|
14
15
|
specs:
|
15
|
-
activesupport (5.2.
|
16
|
+
activesupport (5.2.3)
|
16
17
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
17
18
|
i18n (>= 0.7, < 2)
|
18
19
|
minitest (~> 5.1)
|
@@ -25,7 +26,7 @@ GEM
|
|
25
26
|
coderay (1.1.2)
|
26
27
|
coercible (1.0.0)
|
27
28
|
descendants_tracker (~> 0.0.1)
|
28
|
-
concurrent-ruby (1.
|
29
|
+
concurrent-ruby (1.1.5)
|
29
30
|
descendants_tracker (0.0.4)
|
30
31
|
thread_safe (~> 0.3, >= 0.3.1)
|
31
32
|
diff-lcs (1.3)
|
@@ -37,12 +38,14 @@ GEM
|
|
37
38
|
hashtastic (0.1.2)
|
38
39
|
activesupport (~> 5.0)
|
39
40
|
digest-sha3 (~> 1.1)
|
40
|
-
i18n (1.
|
41
|
+
i18n (1.6.0)
|
41
42
|
concurrent-ruby (~> 1.0)
|
42
43
|
ice_nine (0.11.2)
|
43
44
|
jaro_winkler (1.5.1)
|
44
45
|
method_source (0.9.0)
|
45
46
|
minitest (5.11.3)
|
47
|
+
mixlib-config (2.2.18)
|
48
|
+
tomlrb
|
46
49
|
murky_waters (0.1.4)
|
47
50
|
parallel (1.12.1)
|
48
51
|
parser (2.5.1.2)
|
@@ -75,8 +78,9 @@ GEM
|
|
75
78
|
ruby-progressbar (~> 1.7)
|
76
79
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
77
80
|
ruby-progressbar (1.10.0)
|
78
|
-
thor (0.20.
|
81
|
+
thor (0.20.3)
|
79
82
|
thread_safe (0.3.6)
|
83
|
+
tomlrb (1.2.8)
|
80
84
|
tzinfo (1.2.5)
|
81
85
|
thread_safe (~> 0.1)
|
82
86
|
unicode-display_width (1.4.0)
|
@@ -90,7 +94,7 @@ PLATFORMS
|
|
90
94
|
ruby
|
91
95
|
|
92
96
|
DEPENDENCIES
|
93
|
-
bundler (~>
|
97
|
+
bundler (~> 2.0)
|
94
98
|
pry (~> 0.11.3)
|
95
99
|
rake (~> 10.0)
|
96
100
|
rspec (~> 3.0)
|
@@ -98,4 +102,4 @@ DEPENDENCIES
|
|
98
102
|
voucher!
|
99
103
|
|
100
104
|
BUNDLED WITH
|
101
|
-
|
105
|
+
2.0.1
|
data/README.md
CHANGED
@@ -39,7 +39,7 @@ Embedded in your application
|
|
39
39
|
```rb
|
40
40
|
require 'voucher'
|
41
41
|
|
42
|
-
Voucher.configure(host: 'http://
|
42
|
+
Voucher.configure(host: 'http://localhost:8545')
|
43
43
|
Voucher::Validator.call('segments.json')
|
44
44
|
|
45
45
|
=> true
|
@@ -60,6 +60,48 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
60
60
|
|
61
61
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
62
62
|
|
63
|
+
### Testing
|
64
|
+
|
65
|
+
#### Test from console
|
66
|
+
|
67
|
+
In order to test ruby code in interactive console:
|
68
|
+
|
69
|
+
```
|
70
|
+
$ ./bin/console
|
71
|
+
irb(main):002:0> Voucher.configure(host: 'http://52.208.46.161:8549')
|
72
|
+
irb(main):002:0> Voucher::Validator.call('./spec/samples/segments.json')
|
73
|
+
|
74
|
+
```
|
75
|
+
|
76
|
+
Notice: by default configuration pointing to your `localhost:8545`.
|
77
|
+
When you want to test with ropsten, you need
|
78
|
+
|
79
|
+
#### Test CLI
|
80
|
+
|
81
|
+
Just for this test change the version in `version.rb`.
|
82
|
+
|
83
|
+
```
|
84
|
+
gem uninstall voucher
|
85
|
+
gem build voucher.gemspec
|
86
|
+
gem install --local voucher-[your-version].gem
|
87
|
+
|
88
|
+
# check the instalation
|
89
|
+
gem list
|
90
|
+
|
91
|
+
# run CLI test locally
|
92
|
+
voucher validate ./spec/samples/segments.json -h http://52.208.46.161:8549
|
93
|
+
|
94
|
+
|
95
|
+
```
|
96
|
+
|
97
|
+
#### Run tests
|
98
|
+
|
99
|
+
```
|
100
|
+
bundle exec rubocop
|
101
|
+
bundle exec rspec [file: optional]
|
102
|
+
|
103
|
+
```
|
104
|
+
|
63
105
|
## Contributing
|
64
106
|
|
65
107
|
Bug reports and pull requests are welcome on GitHub at https://github.com/luciditytech/voucher.
|
data/lib/voucher.rb
CHANGED
@@ -9,10 +9,11 @@ require 'pry'
|
|
9
9
|
|
10
10
|
require 'voucher/version'
|
11
11
|
require 'voucher/config'
|
12
|
+
require 'voucher/metrics'
|
12
13
|
require 'voucher/errors'
|
13
14
|
require 'voucher/model/election'
|
14
15
|
require 'voucher/model/segment'
|
15
|
-
require 'voucher/
|
16
|
+
require 'voucher/chain_contract'
|
16
17
|
require 'voucher/segments_reader'
|
17
18
|
require 'voucher/segments_builder'
|
18
19
|
require 'voucher/segments_parser'
|
@@ -24,11 +25,11 @@ module Voucher
|
|
24
25
|
end
|
25
26
|
|
26
27
|
def self.config
|
27
|
-
@config ||= Config
|
28
|
+
@config ||= Config
|
28
29
|
end
|
29
30
|
|
30
31
|
def self.reset
|
31
|
-
@config = Config
|
32
|
+
@config = Config
|
32
33
|
end
|
33
34
|
|
34
35
|
def self.configure(options = {})
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Voucher
|
4
|
+
class ChainContract
|
5
|
+
attr_reader :contract
|
6
|
+
|
7
|
+
def initialize(options = {})
|
8
|
+
@contract = Ethereum::Contract.create(
|
9
|
+
name: options[:name] || 'ChainContractClient',
|
10
|
+
address: options[:address],
|
11
|
+
abi: options[:abi],
|
12
|
+
client: ethereum
|
13
|
+
)
|
14
|
+
|
15
|
+
@roots = {}
|
16
|
+
@formatter = Ethereum::Formatter.new
|
17
|
+
end
|
18
|
+
|
19
|
+
def ethereum
|
20
|
+
@client ||= Ethereum::HttpClient.new(Config.ethereum_url)
|
21
|
+
@client.default_account = Config.default_account
|
22
|
+
|
23
|
+
@client
|
24
|
+
end
|
25
|
+
|
26
|
+
def winning_hash(block_height, shard)
|
27
|
+
@roots[shard] ||= find_root(block_height, shard)
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def find_root(block_height, shard)
|
33
|
+
root = contract.call.get_block_root(block_height, shard)
|
34
|
+
|
35
|
+
raise RootHashNotFound.new(block_height, shard) if root.blank?
|
36
|
+
|
37
|
+
eth_format(root)
|
38
|
+
end
|
39
|
+
|
40
|
+
def eth_format(value)
|
41
|
+
hex = @formatter.from_ascii(value)
|
42
|
+
|
43
|
+
"0x#{hex}"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
data/lib/voucher/cli.rb
CHANGED
data/lib/voucher/config.rb
CHANGED
@@ -1,14 +1,22 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
class Config
|
5
|
-
ABI_FILE_NAME = File.join(File.dirname(__FILE__), 'config', 'json', 'election.json')
|
3
|
+
require 'mixlib/config'
|
6
4
|
|
7
|
-
|
5
|
+
module Config
|
6
|
+
extend Mixlib::Config
|
7
|
+
config_strict_mode true
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
ABI_FILE_NAME = File.join(File.dirname(__FILE__), 'config', 'json', 'chain.json')
|
10
|
+
|
11
|
+
default :ethereum_url, ENV['ETHEREUM_URL'] || 'http://52.208.46.161:8549'
|
12
|
+
default :default_account, ENV['DEFAULT_ACCOUNT'] || '0x1B380DC721280DdBD4E0Cbf342Bf2c23A5FEC96A'
|
13
|
+
default :chain_abi, File.read(ABI_FILE_NAME)
|
14
|
+
|
15
|
+
default :metrics, []
|
16
|
+
default :aggregated_metric_types, []
|
17
|
+
default :non_aggregated_metric_types, []
|
18
|
+
default :cost_metrics, []
|
19
|
+
default :compound_metrics, {}
|
20
|
+
default :compound_metric_types, []
|
21
|
+
default :metric_types, []
|
14
22
|
end
|
@@ -0,0 +1,753 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"constant": true,
|
4
|
+
"inputs": [],
|
5
|
+
"name": "singleStorage",
|
6
|
+
"outputs": [
|
7
|
+
{
|
8
|
+
"name": "",
|
9
|
+
"type": "address"
|
10
|
+
}
|
11
|
+
],
|
12
|
+
"payable": false,
|
13
|
+
"stateMutability": "view",
|
14
|
+
"type": "function"
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"constant": false,
|
18
|
+
"inputs": [],
|
19
|
+
"name": "register",
|
20
|
+
"outputs": [
|
21
|
+
{
|
22
|
+
"name": "",
|
23
|
+
"type": "bool"
|
24
|
+
}
|
25
|
+
],
|
26
|
+
"payable": false,
|
27
|
+
"stateMutability": "nonpayable",
|
28
|
+
"type": "function"
|
29
|
+
},
|
30
|
+
{
|
31
|
+
"constant": true,
|
32
|
+
"inputs": [],
|
33
|
+
"name": "isRegistered",
|
34
|
+
"outputs": [
|
35
|
+
{
|
36
|
+
"name": "",
|
37
|
+
"type": "bool"
|
38
|
+
}
|
39
|
+
],
|
40
|
+
"payable": false,
|
41
|
+
"stateMutability": "view",
|
42
|
+
"type": "function"
|
43
|
+
},
|
44
|
+
{
|
45
|
+
"constant": false,
|
46
|
+
"inputs": [
|
47
|
+
{
|
48
|
+
"name": "_newInstance",
|
49
|
+
"type": "address"
|
50
|
+
}
|
51
|
+
],
|
52
|
+
"name": "unregister",
|
53
|
+
"outputs": [],
|
54
|
+
"payable": false,
|
55
|
+
"stateMutability": "nonpayable",
|
56
|
+
"type": "function"
|
57
|
+
},
|
58
|
+
{
|
59
|
+
"constant": true,
|
60
|
+
"inputs": [],
|
61
|
+
"name": "getAllStorages",
|
62
|
+
"outputs": [
|
63
|
+
{
|
64
|
+
"name": "",
|
65
|
+
"type": "address[]"
|
66
|
+
}
|
67
|
+
],
|
68
|
+
"payable": false,
|
69
|
+
"stateMutability": "view",
|
70
|
+
"type": "function"
|
71
|
+
},
|
72
|
+
{
|
73
|
+
"constant": false,
|
74
|
+
"inputs": [],
|
75
|
+
"name": "renounceOwnership",
|
76
|
+
"outputs": [],
|
77
|
+
"payable": false,
|
78
|
+
"stateMutability": "nonpayable",
|
79
|
+
"type": "function"
|
80
|
+
},
|
81
|
+
{
|
82
|
+
"constant": true,
|
83
|
+
"inputs": [],
|
84
|
+
"name": "owner",
|
85
|
+
"outputs": [
|
86
|
+
{
|
87
|
+
"name": "",
|
88
|
+
"type": "address"
|
89
|
+
}
|
90
|
+
],
|
91
|
+
"payable": false,
|
92
|
+
"stateMutability": "view",
|
93
|
+
"type": "function"
|
94
|
+
},
|
95
|
+
{
|
96
|
+
"constant": true,
|
97
|
+
"inputs": [],
|
98
|
+
"name": "isOwner",
|
99
|
+
"outputs": [
|
100
|
+
{
|
101
|
+
"name": "",
|
102
|
+
"type": "bool"
|
103
|
+
}
|
104
|
+
],
|
105
|
+
"payable": false,
|
106
|
+
"stateMutability": "view",
|
107
|
+
"type": "function"
|
108
|
+
},
|
109
|
+
{
|
110
|
+
"constant": true,
|
111
|
+
"inputs": [],
|
112
|
+
"name": "contractRegistry",
|
113
|
+
"outputs": [
|
114
|
+
{
|
115
|
+
"name": "",
|
116
|
+
"type": "address"
|
117
|
+
}
|
118
|
+
],
|
119
|
+
"payable": false,
|
120
|
+
"stateMutability": "view",
|
121
|
+
"type": "function"
|
122
|
+
},
|
123
|
+
{
|
124
|
+
"constant": false,
|
125
|
+
"inputs": [
|
126
|
+
{
|
127
|
+
"name": "newOwner",
|
128
|
+
"type": "address"
|
129
|
+
}
|
130
|
+
],
|
131
|
+
"name": "transferOwnership",
|
132
|
+
"outputs": [],
|
133
|
+
"payable": false,
|
134
|
+
"stateMutability": "nonpayable",
|
135
|
+
"type": "function"
|
136
|
+
},
|
137
|
+
{
|
138
|
+
"inputs": [
|
139
|
+
{
|
140
|
+
"name": "_contractRegistry",
|
141
|
+
"type": "address"
|
142
|
+
},
|
143
|
+
{
|
144
|
+
"name": "_chainStorage",
|
145
|
+
"type": "address"
|
146
|
+
}
|
147
|
+
],
|
148
|
+
"payable": false,
|
149
|
+
"stateMutability": "nonpayable",
|
150
|
+
"type": "constructor"
|
151
|
+
},
|
152
|
+
{
|
153
|
+
"anonymous": false,
|
154
|
+
"inputs": [
|
155
|
+
{
|
156
|
+
"indexed": true,
|
157
|
+
"name": "previousOwner",
|
158
|
+
"type": "address"
|
159
|
+
},
|
160
|
+
{
|
161
|
+
"indexed": true,
|
162
|
+
"name": "newOwner",
|
163
|
+
"type": "address"
|
164
|
+
}
|
165
|
+
],
|
166
|
+
"name": "OwnershipTransferred",
|
167
|
+
"type": "event"
|
168
|
+
},
|
169
|
+
{
|
170
|
+
"anonymous": false,
|
171
|
+
"inputs": [
|
172
|
+
{
|
173
|
+
"indexed": true,
|
174
|
+
"name": "executor",
|
175
|
+
"type": "address"
|
176
|
+
},
|
177
|
+
{
|
178
|
+
"indexed": true,
|
179
|
+
"name": "newStorageOwner",
|
180
|
+
"type": "address"
|
181
|
+
}
|
182
|
+
],
|
183
|
+
"name": "LogDetachFromStorage",
|
184
|
+
"type": "event"
|
185
|
+
},
|
186
|
+
{
|
187
|
+
"anonymous": false,
|
188
|
+
"inputs": [
|
189
|
+
{
|
190
|
+
"indexed": true,
|
191
|
+
"name": "storageAddress",
|
192
|
+
"type": "address"
|
193
|
+
}
|
194
|
+
],
|
195
|
+
"name": "LogNewStorage",
|
196
|
+
"type": "event"
|
197
|
+
},
|
198
|
+
{
|
199
|
+
"anonymous": false,
|
200
|
+
"inputs": [
|
201
|
+
{
|
202
|
+
"indexed": true,
|
203
|
+
"name": "executor",
|
204
|
+
"type": "address"
|
205
|
+
},
|
206
|
+
{
|
207
|
+
"indexed": true,
|
208
|
+
"name": "registered",
|
209
|
+
"type": "address"
|
210
|
+
},
|
211
|
+
{
|
212
|
+
"indexed": false,
|
213
|
+
"name": "isRegistered",
|
214
|
+
"type": "bool"
|
215
|
+
}
|
216
|
+
],
|
217
|
+
"name": "LogRegister",
|
218
|
+
"type": "event"
|
219
|
+
},
|
220
|
+
{
|
221
|
+
"anonymous": false,
|
222
|
+
"inputs": [
|
223
|
+
{
|
224
|
+
"indexed": false,
|
225
|
+
"name": "balance",
|
226
|
+
"type": "uint256"
|
227
|
+
},
|
228
|
+
{
|
229
|
+
"indexed": true,
|
230
|
+
"name": "balanceReceiver",
|
231
|
+
"type": "address"
|
232
|
+
}
|
233
|
+
],
|
234
|
+
"name": "LogSuicide",
|
235
|
+
"type": "event"
|
236
|
+
},
|
237
|
+
{
|
238
|
+
"anonymous": false,
|
239
|
+
"inputs": [
|
240
|
+
{
|
241
|
+
"indexed": true,
|
242
|
+
"name": "sender",
|
243
|
+
"type": "address"
|
244
|
+
},
|
245
|
+
{
|
246
|
+
"indexed": false,
|
247
|
+
"name": "blockHeight",
|
248
|
+
"type": "uint256"
|
249
|
+
},
|
250
|
+
{
|
251
|
+
"indexed": false,
|
252
|
+
"name": "blindedProposal",
|
253
|
+
"type": "bytes32"
|
254
|
+
},
|
255
|
+
{
|
256
|
+
"indexed": false,
|
257
|
+
"name": "shard",
|
258
|
+
"type": "uint256"
|
259
|
+
},
|
260
|
+
{
|
261
|
+
"indexed": false,
|
262
|
+
"name": "balance",
|
263
|
+
"type": "uint256"
|
264
|
+
}
|
265
|
+
],
|
266
|
+
"name": "LogPropose",
|
267
|
+
"type": "event"
|
268
|
+
},
|
269
|
+
{
|
270
|
+
"anonymous": false,
|
271
|
+
"inputs": [
|
272
|
+
{
|
273
|
+
"indexed": true,
|
274
|
+
"name": "sender",
|
275
|
+
"type": "address"
|
276
|
+
},
|
277
|
+
{
|
278
|
+
"indexed": false,
|
279
|
+
"name": "blockHeight",
|
280
|
+
"type": "uint256"
|
281
|
+
},
|
282
|
+
{
|
283
|
+
"indexed": false,
|
284
|
+
"name": "proposal",
|
285
|
+
"type": "bytes32"
|
286
|
+
}
|
287
|
+
],
|
288
|
+
"name": "LogReveal",
|
289
|
+
"type": "event"
|
290
|
+
},
|
291
|
+
{
|
292
|
+
"anonymous": false,
|
293
|
+
"inputs": [
|
294
|
+
{
|
295
|
+
"indexed": true,
|
296
|
+
"name": "sender",
|
297
|
+
"type": "address"
|
298
|
+
},
|
299
|
+
{
|
300
|
+
"indexed": false,
|
301
|
+
"name": "blockHeight",
|
302
|
+
"type": "uint256"
|
303
|
+
},
|
304
|
+
{
|
305
|
+
"indexed": false,
|
306
|
+
"name": "shard",
|
307
|
+
"type": "uint256"
|
308
|
+
},
|
309
|
+
{
|
310
|
+
"indexed": false,
|
311
|
+
"name": "proposal",
|
312
|
+
"type": "bytes32"
|
313
|
+
},
|
314
|
+
{
|
315
|
+
"indexed": false,
|
316
|
+
"name": "counts",
|
317
|
+
"type": "uint256"
|
318
|
+
},
|
319
|
+
{
|
320
|
+
"indexed": false,
|
321
|
+
"name": "balance",
|
322
|
+
"type": "uint256"
|
323
|
+
},
|
324
|
+
{
|
325
|
+
"indexed": false,
|
326
|
+
"name": "newWinner",
|
327
|
+
"type": "bool"
|
328
|
+
},
|
329
|
+
{
|
330
|
+
"indexed": false,
|
331
|
+
"name": "totalTokenBalanceForShard",
|
332
|
+
"type": "uint256"
|
333
|
+
}
|
334
|
+
],
|
335
|
+
"name": "LogUpdateCounters",
|
336
|
+
"type": "event"
|
337
|
+
},
|
338
|
+
{
|
339
|
+
"constant": true,
|
340
|
+
"inputs": [],
|
341
|
+
"name": "contractName",
|
342
|
+
"outputs": [
|
343
|
+
{
|
344
|
+
"name": "",
|
345
|
+
"type": "bytes32"
|
346
|
+
}
|
347
|
+
],
|
348
|
+
"payable": false,
|
349
|
+
"stateMutability": "view",
|
350
|
+
"type": "function"
|
351
|
+
},
|
352
|
+
{
|
353
|
+
"constant": false,
|
354
|
+
"inputs": [
|
355
|
+
{
|
356
|
+
"name": "_blindedProposal",
|
357
|
+
"type": "bytes32"
|
358
|
+
},
|
359
|
+
{
|
360
|
+
"name": "_blockHeight",
|
361
|
+
"type": "uint256"
|
362
|
+
}
|
363
|
+
],
|
364
|
+
"name": "propose",
|
365
|
+
"outputs": [
|
366
|
+
{
|
367
|
+
"name": "",
|
368
|
+
"type": "bool"
|
369
|
+
}
|
370
|
+
],
|
371
|
+
"payable": false,
|
372
|
+
"stateMutability": "nonpayable",
|
373
|
+
"type": "function"
|
374
|
+
},
|
375
|
+
{
|
376
|
+
"constant": false,
|
377
|
+
"inputs": [
|
378
|
+
{
|
379
|
+
"name": "_proposal",
|
380
|
+
"type": "bytes32"
|
381
|
+
},
|
382
|
+
{
|
383
|
+
"name": "_secret",
|
384
|
+
"type": "bytes32"
|
385
|
+
}
|
386
|
+
],
|
387
|
+
"name": "reveal",
|
388
|
+
"outputs": [
|
389
|
+
{
|
390
|
+
"name": "",
|
391
|
+
"type": "bool"
|
392
|
+
}
|
393
|
+
],
|
394
|
+
"payable": false,
|
395
|
+
"stateMutability": "nonpayable",
|
396
|
+
"type": "function"
|
397
|
+
},
|
398
|
+
{
|
399
|
+
"constant": true,
|
400
|
+
"inputs": [],
|
401
|
+
"name": "getBlockHeight",
|
402
|
+
"outputs": [
|
403
|
+
{
|
404
|
+
"name": "",
|
405
|
+
"type": "uint256"
|
406
|
+
}
|
407
|
+
],
|
408
|
+
"payable": false,
|
409
|
+
"stateMutability": "view",
|
410
|
+
"type": "function"
|
411
|
+
},
|
412
|
+
{
|
413
|
+
"constant": true,
|
414
|
+
"inputs": [
|
415
|
+
{
|
416
|
+
"name": "_proposal",
|
417
|
+
"type": "bytes32"
|
418
|
+
},
|
419
|
+
{
|
420
|
+
"name": "_secret",
|
421
|
+
"type": "bytes32"
|
422
|
+
}
|
423
|
+
],
|
424
|
+
"name": "createProof",
|
425
|
+
"outputs": [
|
426
|
+
{
|
427
|
+
"name": "",
|
428
|
+
"type": "bytes32"
|
429
|
+
}
|
430
|
+
],
|
431
|
+
"payable": false,
|
432
|
+
"stateMutability": "pure",
|
433
|
+
"type": "function"
|
434
|
+
},
|
435
|
+
{
|
436
|
+
"constant": true,
|
437
|
+
"inputs": [
|
438
|
+
{
|
439
|
+
"name": "_blockHeight",
|
440
|
+
"type": "uint256"
|
441
|
+
},
|
442
|
+
{
|
443
|
+
"name": "_shard",
|
444
|
+
"type": "uint256"
|
445
|
+
}
|
446
|
+
],
|
447
|
+
"name": "getBlockRoot",
|
448
|
+
"outputs": [
|
449
|
+
{
|
450
|
+
"name": "",
|
451
|
+
"type": "bytes32"
|
452
|
+
}
|
453
|
+
],
|
454
|
+
"payable": false,
|
455
|
+
"stateMutability": "view",
|
456
|
+
"type": "function"
|
457
|
+
},
|
458
|
+
{
|
459
|
+
"constant": true,
|
460
|
+
"inputs": [
|
461
|
+
{
|
462
|
+
"name": "_blockHeight",
|
463
|
+
"type": "uint256"
|
464
|
+
},
|
465
|
+
{
|
466
|
+
"name": "_voter",
|
467
|
+
"type": "address"
|
468
|
+
}
|
469
|
+
],
|
470
|
+
"name": "getBlockVoter",
|
471
|
+
"outputs": [
|
472
|
+
{
|
473
|
+
"name": "blindedProposal",
|
474
|
+
"type": "bytes32"
|
475
|
+
},
|
476
|
+
{
|
477
|
+
"name": "shard",
|
478
|
+
"type": "uint256"
|
479
|
+
},
|
480
|
+
{
|
481
|
+
"name": "proposal",
|
482
|
+
"type": "bytes32"
|
483
|
+
},
|
484
|
+
{
|
485
|
+
"name": "balance",
|
486
|
+
"type": "uint256"
|
487
|
+
}
|
488
|
+
],
|
489
|
+
"payable": false,
|
490
|
+
"stateMutability": "view",
|
491
|
+
"type": "function"
|
492
|
+
},
|
493
|
+
{
|
494
|
+
"constant": true,
|
495
|
+
"inputs": [
|
496
|
+
{
|
497
|
+
"name": "_blockHeight",
|
498
|
+
"type": "uint256"
|
499
|
+
},
|
500
|
+
{
|
501
|
+
"name": "_shard",
|
502
|
+
"type": "uint256"
|
503
|
+
}
|
504
|
+
],
|
505
|
+
"name": "getBlockMaxVotes",
|
506
|
+
"outputs": [
|
507
|
+
{
|
508
|
+
"name": "",
|
509
|
+
"type": "uint256"
|
510
|
+
}
|
511
|
+
],
|
512
|
+
"payable": false,
|
513
|
+
"stateMutability": "view",
|
514
|
+
"type": "function"
|
515
|
+
},
|
516
|
+
{
|
517
|
+
"constant": true,
|
518
|
+
"inputs": [
|
519
|
+
{
|
520
|
+
"name": "_blockHeight",
|
521
|
+
"type": "uint256"
|
522
|
+
},
|
523
|
+
{
|
524
|
+
"name": "_shard",
|
525
|
+
"type": "uint256"
|
526
|
+
},
|
527
|
+
{
|
528
|
+
"name": "_proposal",
|
529
|
+
"type": "bytes32"
|
530
|
+
}
|
531
|
+
],
|
532
|
+
"name": "getBlockCount",
|
533
|
+
"outputs": [
|
534
|
+
{
|
535
|
+
"name": "",
|
536
|
+
"type": "uint256"
|
537
|
+
}
|
538
|
+
],
|
539
|
+
"payable": false,
|
540
|
+
"stateMutability": "view",
|
541
|
+
"type": "function"
|
542
|
+
},
|
543
|
+
{
|
544
|
+
"constant": true,
|
545
|
+
"inputs": [
|
546
|
+
{
|
547
|
+
"name": "_blockHeight",
|
548
|
+
"type": "uint256"
|
549
|
+
},
|
550
|
+
{
|
551
|
+
"name": "_i",
|
552
|
+
"type": "uint256"
|
553
|
+
}
|
554
|
+
],
|
555
|
+
"name": "getBlockAddress",
|
556
|
+
"outputs": [
|
557
|
+
{
|
558
|
+
"name": "",
|
559
|
+
"type": "address"
|
560
|
+
}
|
561
|
+
],
|
562
|
+
"payable": false,
|
563
|
+
"stateMutability": "view",
|
564
|
+
"type": "function"
|
565
|
+
},
|
566
|
+
{
|
567
|
+
"constant": true,
|
568
|
+
"inputs": [
|
569
|
+
{
|
570
|
+
"name": "_blockHeight",
|
571
|
+
"type": "uint256"
|
572
|
+
}
|
573
|
+
],
|
574
|
+
"name": "getBlockAddressCount",
|
575
|
+
"outputs": [
|
576
|
+
{
|
577
|
+
"name": "",
|
578
|
+
"type": "uint256"
|
579
|
+
}
|
580
|
+
],
|
581
|
+
"payable": false,
|
582
|
+
"stateMutability": "view",
|
583
|
+
"type": "function"
|
584
|
+
},
|
585
|
+
{
|
586
|
+
"constant": true,
|
587
|
+
"inputs": [
|
588
|
+
{
|
589
|
+
"name": "_blockHeight",
|
590
|
+
"type": "uint256"
|
591
|
+
},
|
592
|
+
{
|
593
|
+
"name": "_shard",
|
594
|
+
"type": "uint256"
|
595
|
+
}
|
596
|
+
],
|
597
|
+
"name": "getStakeTokenBalanceFor",
|
598
|
+
"outputs": [
|
599
|
+
{
|
600
|
+
"name": "",
|
601
|
+
"type": "uint256"
|
602
|
+
}
|
603
|
+
],
|
604
|
+
"payable": false,
|
605
|
+
"stateMutability": "view",
|
606
|
+
"type": "function"
|
607
|
+
},
|
608
|
+
{
|
609
|
+
"constant": true,
|
610
|
+
"inputs": [
|
611
|
+
{
|
612
|
+
"name": "_blockHeight",
|
613
|
+
"type": "uint256"
|
614
|
+
},
|
615
|
+
{
|
616
|
+
"name": "_shard",
|
617
|
+
"type": "uint256"
|
618
|
+
}
|
619
|
+
],
|
620
|
+
"name": "isElectionValid",
|
621
|
+
"outputs": [
|
622
|
+
{
|
623
|
+
"name": "",
|
624
|
+
"type": "bool"
|
625
|
+
}
|
626
|
+
],
|
627
|
+
"payable": false,
|
628
|
+
"stateMutability": "view",
|
629
|
+
"type": "function"
|
630
|
+
},
|
631
|
+
{
|
632
|
+
"constant": false,
|
633
|
+
"inputs": [
|
634
|
+
{
|
635
|
+
"name": "_minimumStakingTokenPercentage",
|
636
|
+
"type": "uint8"
|
637
|
+
}
|
638
|
+
],
|
639
|
+
"name": "updateMinimumStakingTokenPercentage",
|
640
|
+
"outputs": [
|
641
|
+
{
|
642
|
+
"name": "",
|
643
|
+
"type": "bool"
|
644
|
+
}
|
645
|
+
],
|
646
|
+
"payable": false,
|
647
|
+
"stateMutability": "nonpayable",
|
648
|
+
"type": "function"
|
649
|
+
},
|
650
|
+
{
|
651
|
+
"constant": true,
|
652
|
+
"inputs": [],
|
653
|
+
"name": "updateMinimumStakingTokenPercentageEnabled",
|
654
|
+
"outputs": [
|
655
|
+
{
|
656
|
+
"name": "",
|
657
|
+
"type": "bool"
|
658
|
+
}
|
659
|
+
],
|
660
|
+
"payable": false,
|
661
|
+
"stateMutability": "view",
|
662
|
+
"type": "function"
|
663
|
+
},
|
664
|
+
{
|
665
|
+
"constant": true,
|
666
|
+
"inputs": [],
|
667
|
+
"name": "minimumStakingTokenPercentage",
|
668
|
+
"outputs": [
|
669
|
+
{
|
670
|
+
"name": "",
|
671
|
+
"type": "uint8"
|
672
|
+
}
|
673
|
+
],
|
674
|
+
"payable": false,
|
675
|
+
"stateMutability": "view",
|
676
|
+
"type": "function"
|
677
|
+
},
|
678
|
+
{
|
679
|
+
"constant": true,
|
680
|
+
"inputs": [],
|
681
|
+
"name": "blocksPerPhase",
|
682
|
+
"outputs": [
|
683
|
+
{
|
684
|
+
"name": "",
|
685
|
+
"type": "uint8"
|
686
|
+
}
|
687
|
+
],
|
688
|
+
"payable": false,
|
689
|
+
"stateMutability": "view",
|
690
|
+
"type": "function"
|
691
|
+
},
|
692
|
+
{
|
693
|
+
"constant": true,
|
694
|
+
"inputs": [],
|
695
|
+
"name": "getCurrentElectionCycleBlock",
|
696
|
+
"outputs": [
|
697
|
+
{
|
698
|
+
"name": "",
|
699
|
+
"type": "uint256"
|
700
|
+
}
|
701
|
+
],
|
702
|
+
"payable": false,
|
703
|
+
"stateMutability": "view",
|
704
|
+
"type": "function"
|
705
|
+
},
|
706
|
+
{
|
707
|
+
"constant": true,
|
708
|
+
"inputs": [],
|
709
|
+
"name": "getFirstCycleBlock",
|
710
|
+
"outputs": [
|
711
|
+
{
|
712
|
+
"name": "",
|
713
|
+
"type": "uint256"
|
714
|
+
}
|
715
|
+
],
|
716
|
+
"payable": false,
|
717
|
+
"stateMutability": "view",
|
718
|
+
"type": "function"
|
719
|
+
},
|
720
|
+
{
|
721
|
+
"constant": true,
|
722
|
+
"inputs": [],
|
723
|
+
"name": "isProposePhase",
|
724
|
+
"outputs": [
|
725
|
+
{
|
726
|
+
"name": "",
|
727
|
+
"type": "bool"
|
728
|
+
}
|
729
|
+
],
|
730
|
+
"payable": false,
|
731
|
+
"stateMutability": "view",
|
732
|
+
"type": "function"
|
733
|
+
},
|
734
|
+
{
|
735
|
+
"constant": true,
|
736
|
+
"inputs": [
|
737
|
+
{
|
738
|
+
"name": "_shard",
|
739
|
+
"type": "uint256"
|
740
|
+
}
|
741
|
+
],
|
742
|
+
"name": "initialBlockHeights",
|
743
|
+
"outputs": [
|
744
|
+
{
|
745
|
+
"name": "",
|
746
|
+
"type": "uint256"
|
747
|
+
}
|
748
|
+
],
|
749
|
+
"payable": false,
|
750
|
+
"stateMutability": "view",
|
751
|
+
"type": "function"
|
752
|
+
}
|
753
|
+
]
|