File tree 3 files changed +63
-0
lines changed
3 files changed +63
-0
lines changed Original file line number Diff line number Diff line change
1
+ source 'https://rubygems.org'
2
+
3
+ gem "eth"
Original file line number Diff line number Diff line change
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ digest-sha3 (1.1.0 )
5
+ eth (0.4.6 )
6
+ digest-sha3 (~> 1.1 )
7
+ ffi (~> 1.0 )
8
+ money-tree (~> 0.9 )
9
+ rlp (~> 0.7.3 )
10
+ scrypt (~> 3.0.5 )
11
+ ffi (1.9.23 )
12
+ ffi-compiler (1.0.1 )
13
+ ffi (>= 1.0.0 )
14
+ rake
15
+ money-tree (0.9.0 )
16
+ ffi
17
+ rake (12.3.1 )
18
+ rlp (0.7.3 )
19
+ scrypt (3.0.5 )
20
+ ffi-compiler (>= 1.0 , < 2.0 )
21
+
22
+ PLATFORMS
23
+ ruby
24
+
25
+ DEPENDENCIES
26
+ eth
27
+
28
+ BUNDLED WITH
29
+ 1.16.1
Original file line number Diff line number Diff line change
1
+ require "eth"
2
+ require "json"
3
+
4
+ workdir = Dir . pwd
5
+
6
+ Dir . each_child ( "erc20" ) do |file |
7
+ next if file == "$template.json" || !file . end_with? ( "json" )
8
+ puts "processing file:#{ file } "
9
+ fullpath = "#{ workdir } /erc20/#{ file } "
10
+ begin
11
+ json = JSON . parse IO . read ( fullpath )
12
+ rescue => e
13
+ puts e . message
14
+ exit false
15
+ end
16
+ address_text = json [ "address" ]
17
+ downcase_address = address_text . downcase
18
+ checksum_address = Eth ::Utils . format_address address_text
19
+
20
+ if address_text != checksum_address
21
+ puts "rewrite file:#{ file } "
22
+ json [ "address" ] = checksum_address
23
+ File . open ( fullpath , 'w' ) { |f | f . write JSON . pretty_generate ( json , indent : " " *4 ) }
24
+ end
25
+
26
+ img = "#{ workdir } /images/#{ downcase_address } .png"
27
+ if File . exists? ( img )
28
+ puts "rewrite image:#{ file } "
29
+ File . rename ( img , "#{ workdir } /images/#{ checksum_address } .png" )
30
+ end
31
+ end
You can’t perform that action at this time.
0 commit comments