-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtransfer_coins.py
145 lines (126 loc) · 5.35 KB
/
transfer_coins.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
"""
Script used to import coins from bitHopper
"""
import ConfigParser
"""
parse = ConfigParser.SafeConfigParser()
parse.read('../bitHopper/whatevercoin.cfg')
for item in parse.sections():
coin_info = dict(parse.items(item))
for k in coin_info.keys():
if 'exchange' in k:
del coin_info[k]
config = ConfigParser.SafeConfigParser()
config.add_section('general')
for k,v in coin_info.items():
config.set('general', k, v)
with open('./coins/%s' % coin_info['short_name'], 'wb') as configfile:
config.write(configfile)
"""
"""
parse = ConfigParser.RawConfigParser()
parse.read('../bitHopper/diffwebs.cfg')
for item in parse.sections():
coin_info = dict(parse.items(item))
if coin_info['get_method'] == 'regexp':
coin_info['get_method'] = 're'
config = ConfigParser.RawConfigParser()
config.add_section('general')
config.set('general', 'coin', coin_info['coin'])
config.set('general', 'name', item)
coin = coin_info['coin']
config.add_section(coin)
config.set(coin, 'address', coin_info['url'])
config.set(coin, 'method', coin_info['get_method'])
if 'pattern' in coin_info:
config.set(coin, 'key', coin_info['pattern'])
with open('./difficulty_sites/%s' % item, 'wb') as configfile:
config.write(configfile)
"""
parse = ConfigParser.RawConfigParser()
parse.read('../bitHopper/pools.cfg')
parse.read('../bitHopper/user.cfg.default')
for item in parse.sections():
pool_info = dict(parse.items(item))
if 'api_method' not in pool_info:
continue
config = ConfigParser.RawConfigParser()
config.add_section('general')
config.set('general', 'coin', pool_info['coin'])
config.set('general', 'name', item)
config.set('general', 'payout_scheme', pool_info.get('payout_scheme','unknown'))
config.set('general', 'payout_mm', str('payout_merged_mining' in pool_info))
config.add_section('mine')
config.set('mine','address', pool_info['mine_address'])
if 'lp_address' in pool_info:
config.add_section('lp')
config.set('lp', 'address', pool_info['lp_address'])
config.add_section('shares')
if 're' in pool_info['api_method']:
method = 're'
else:
method = 'json'
for k,v in pool_info.items():
if 'api' in k and 'duration' not in k and 'hashrate' not in k:
k = k.replace('api_','')
if k == 'address':
k = 'source'
config.set('shares', k, v)
elif k == 'api_key_mhashrate':
config.add_section('rate')
config.set('rate', 'method', method)
config.set('rate', 'source', pool_info['api_address'])
config.set('rate', 'key', v)
config.set('rate', 'scale', 'mh')
elif k == 'api_key_ghashrate':
config.add_section('rate')
config.set('rate', 'method', method)
config.set('rate', 'source', pool_info['api_address'])
config.set('rate', 'key', v)
config.set('rate', 'scale', 'gh')
elif k == 'api_key_hashrate':
config.add_section('rate')
config.set('rate', 'method', method)
config.set('rate', 'source', pool_info['api_address'])
config.set('rate', 'key', v)
config.set('rate', 'scale', 'h')
elif k == 'api_key_khashrate':
config.add_section('rate')
config.set('rate', 'method', method)
config.set('rate', 'source', pool_info['api_address'])
config.set('rate', 'key', v)
config.set('rate', 'scale', 'kh')
elif 'api_key_duration_' in k:
fields = k.split('_')[3:]
config.add_section('duration')
config.set('duration', 'method', 'duration')
config.set('duration', 'source', pool_info['api_address'])
config.set('duration', 'items' , ",".join(fields))
config.set('duration', 'key', v)
if 'api_key_duration' in pool_info:
config.set('duration', 'source', 'duration_pre')
config.add_section('duration_pre')
config.set('duration_pre', 'source', pool_info['api_address'])
config.set('duration_pre', 'method', method)
config.set('duration_pre', 'key', pool_info['api_key_duration'])
elif 'duration' in k:
print k
elif 'api' in k and 'hashrate' in k:
print k
shares_info = dict(config.items('shares'))
for k,v in shares_info.items():
if k == 'method' and v == 're_rate':
config.add_section('rate')
for k,v in shares_info.items():
config.set('rate', k, v)
config.remove_option('shares', k)
#This should be checked
config.set('rate', 'scale', 'gh')
config.set('rate', 'method', 're')
config.set('shares', 'method', 'rate')
config.set('shares', 'source', 'rate,time:30')
if k == 'method' and v == 're_rateduration':
config.set('shares', 'source', 'rate,duration')
config.set('shares', 'method', 'rateduration')
with open('./pools/%s' % item, 'wb') as configfile:
config.write(configfile)