File tree 2 files changed +31
-0
lines changed
2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ require 'net/http'
2
+ require 'json'
3
+
4
+ def get_direct_remain
5
+ direct_url = "https://api.etherscan.io/api?module=stats&action=tokensupply&contractaddress=0x887834D3b8D450B6bAB109c252Df3DA286d73CE4&apikey=AWEG6NREPDJXSKZYQHTMBHZFN5FSBZF3VR"
6
+
7
+ resp = Net ::HTTP . get_response ( URI . parse ( direct_url ) )
8
+ result = JSON . parse ( resp . body )
9
+
10
+ total = 20_000_000
11
+ issued = result [ "result" ] . to_i / 10 **18
12
+
13
+ direct_remain = total - issued
14
+ rescue
15
+ 0
16
+ end
17
+
18
+
19
+ ico_goal = 20_000_000
20
+ raised = ico_goal - get_direct_remain
21
+
22
+ progress = raised . to_f / ico_goal
23
+ output = { progress : ( progress * 100 ) . to_i }
24
+
25
+
26
+ File . open ( './progress.json' , 'w' ) { |file |
27
+ file . write ( JSON . pretty_generate ( output ) )
28
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "progress" : 99
3
+ }
You can’t perform that action at this time.
0 commit comments