getsourcecode 2.0.10__tar.gz → 2.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- getsourcecode-2.1.0/PKG-INFO +234 -0
- {getsourcecode-2.0.10 → getsourcecode-2.1.0}/README.rst +20 -12
- {getsourcecode-2.0.10 → getsourcecode-2.1.0}/getsourcecode/__init__.py +7 -9
- {getsourcecode-2.0.10 → getsourcecode-2.1.0}/getsourcecode/check.py +1 -1
- {getsourcecode-2.0.10 → getsourcecode-2.1.0}/getsourcecode/common.py +3 -3
- getsourcecode-2.1.0/getsourcecode/config.py +175 -0
- {getsourcecode-2.0.10 → getsourcecode-2.1.0}/getsourcecode/filter.py +5 -5
- {getsourcecode-2.0.10 → getsourcecode-2.1.0}/getsourcecode/handle.py +15 -14
- {getsourcecode-2.0.10 → getsourcecode-2.1.0}/getsourcecode/keys.py +6 -16
- getsourcecode-2.1.0/getsourcecode/menu.py +43 -0
- getsourcecode-2.1.0/getsourcecode.egg-info/PKG-INFO +234 -0
- {getsourcecode-2.0.10 → getsourcecode-2.1.0}/getsourcecode.egg-info/entry_points.txt +0 -1
- {getsourcecode-2.0.10 → getsourcecode-2.1.0}/setup.py +1 -1
- getsourcecode-2.0.10/PKG-INFO +0 -225
- getsourcecode-2.0.10/getsourcecode/config.py +0 -333
- getsourcecode-2.0.10/getsourcecode/menu.py +0 -42
- getsourcecode-2.0.10/getsourcecode.egg-info/PKG-INFO +0 -225
- {getsourcecode-2.0.10 → getsourcecode-2.1.0}/LICENSE +0 -0
- {getsourcecode-2.0.10 → getsourcecode-2.1.0}/getsourcecode.egg-info/SOURCES.txt +0 -0
- {getsourcecode-2.0.10 → getsourcecode-2.1.0}/getsourcecode.egg-info/dependency_links.txt +0 -0
- {getsourcecode-2.0.10 → getsourcecode-2.1.0}/getsourcecode.egg-info/requires.txt +0 -0
- {getsourcecode-2.0.10 → getsourcecode-2.1.0}/getsourcecode.egg-info/top_level.txt +0 -0
- {getsourcecode-2.0.10 → getsourcecode-2.1.0}/setup.cfg +0 -0
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: getsourcecode
|
|
3
|
+
Version: 2.1.0
|
|
4
|
+
Summary: Simple way to get contract source code verified on blockchain explorer.
|
|
5
|
+
Home-page: https://github.com/5hawnXu/getsourcecode
|
|
6
|
+
Author: Shawn Xu
|
|
7
|
+
Author-email: support@hxzy.me
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: retrying
|
|
10
|
+
|
|
11
|
+
getSourceCode
|
|
12
|
+
=============
|
|
13
|
+
|
|
14
|
+
This tool is designed to quickly download the code of open source
|
|
15
|
+
contracts on the blockchain explorer.
|
|
16
|
+
|
|
17
|
+
The downloaded code maintains the file directory structure at the time
|
|
18
|
+
of verification.
|
|
19
|
+
|
|
20
|
+
Supported Chain Platforms:
|
|
21
|
+
|
|
22
|
+
::
|
|
23
|
+
|
|
24
|
+
Ethereum Mainnet | Sepolia Testnet | Hoodi Testnet
|
|
25
|
+
BNB Smart Chain Mainnet | BNB Smart Chain Testnet
|
|
26
|
+
Polygon Mainnet | Polygon Amoy Testnet
|
|
27
|
+
Base Mainnet | Base Sepolia Testnet
|
|
28
|
+
Arbitrum One Mainnet | Arbitrum Sepolia Testnet
|
|
29
|
+
Linea Mainnet | Linea Sepolia Testnet
|
|
30
|
+
Blast Mainnet | Blast Sepolia Testnet
|
|
31
|
+
OP Mainnet | OP Sepolia Testnet
|
|
32
|
+
Avalanche C-Chain | Avalanche Fuji Testnet
|
|
33
|
+
BitTorrent Chain Mainnet | BitTorrent Chain Testnet
|
|
34
|
+
Celo Mainnet | Celo Sepolia Testnet
|
|
35
|
+
Fraxtal Mainnet | Fraxtal Hoodi Testnet
|
|
36
|
+
Gnosis...
|
|
37
|
+
|
|
38
|
+
Chain names are case-insensitive.
|
|
39
|
+
|
|
40
|
+
Some chains (e.g. BNB Smart Chain, Base, OP, Avalanche) require a paid API plan.
|
|
41
|
+
|
|
42
|
+
For the full list of supported chains, visit: https://docs.etherscan.io/supported-chains
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
Get code by tx only supports:
|
|
47
|
+
|
|
48
|
+
::
|
|
49
|
+
|
|
50
|
+
arbi|arbi-nova|avax|base|boba|bsc
|
|
51
|
+
cronos|eth|fantom|gnosis|heco|klaytn
|
|
52
|
+
moonbeam|moonriver|opt|poly||ronin
|
|
53
|
+
|
|
54
|
+
arbi-testnet|avax-testnet|base-testnet
|
|
55
|
+
boba-testnet|bsc-testnet|ftm-testnet
|
|
56
|
+
goerli|opt-testnet|poly-testnet
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
Install
|
|
61
|
+
=======
|
|
62
|
+
|
|
63
|
+
::
|
|
64
|
+
|
|
65
|
+
pip install getSourceCode
|
|
66
|
+
|
|
67
|
+
Usage
|
|
68
|
+
=====
|
|
69
|
+
|
|
70
|
+
::
|
|
71
|
+
|
|
72
|
+
getCode [-h] [-i INPUTFILE] [-o OUTPUTFOLDER] [-a ADDRESS] [-n NETWORK] [-k KEY] [-p PROXY] [-t TXHASH] [-u] [-v] [--apikey APIKEY]
|
|
73
|
+
|
|
74
|
+
For example:
|
|
75
|
+
|
|
76
|
+
::
|
|
77
|
+
|
|
78
|
+
getCode -n bsc -a 0xb51eaa437AC67A631e2FEca0a18dA7a6391c0D07
|
|
79
|
+
|
|
80
|
+
or
|
|
81
|
+
|
|
82
|
+
::
|
|
83
|
+
|
|
84
|
+
getCode -n eth -a 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 -p 127.0.0.1:7890
|
|
85
|
+
|
|
86
|
+
The command execution result is as follows:
|
|
87
|
+
|
|
88
|
+
::
|
|
89
|
+
|
|
90
|
+
[root@hxzy test]# getCode -n bsc -a 0xb51eaa437AC67A631e2FEca0a18dA7a6391c0D07
|
|
91
|
+
0-0: SynthereumManager/deploy/@openzeppelin/contracts/access/AccessControl.sol
|
|
92
|
+
0-1: SynthereumManager/deploy/@openzeppelin/contracts/access/IAccessControl.sol
|
|
93
|
+
0-2: SynthereumManager/deploy/@openzeppelin/contracts/utils/Context.sol
|
|
94
|
+
0-3: SynthereumManager/deploy/@openzeppelin/contracts/utils/Strings.sol
|
|
95
|
+
0-4: SynthereumManager/deploy/@openzeppelin/contracts/utils/introspection/ERC165.sol
|
|
96
|
+
0-5: SynthereumManager/deploy/@openzeppelin/contracts/utils/introspection/IERC165.sol
|
|
97
|
+
0-6: SynthereumManager/deploy/@openzeppelin/contracts/access/AccessControlEnumerable.sol
|
|
98
|
+
0-7: SynthereumManager/deploy/@openzeppelin/contracts/access/IAccessControlEnumerable.sol
|
|
99
|
+
0-8: SynthereumManager/deploy/@openzeppelin/contracts/utils/structs/EnumerableSet.sol
|
|
100
|
+
0-9: SynthereumManager/deploy/contracts/core/Manager.sol
|
|
101
|
+
0-10: SynthereumManager/deploy/contracts/core/interfaces/IFinder.sol
|
|
102
|
+
0-11: SynthereumManager/deploy/contracts/core/interfaces/IManager.sol
|
|
103
|
+
0-12: SynthereumManager/deploy/contracts/common/interfaces/IEmergencyShutdown.sol
|
|
104
|
+
0-13: SynthereumManager/deploy/contracts/core/Constants.sol
|
|
105
|
+
0-14: SynthereumManager/deploy/contracts/core/Finder.sol
|
|
106
|
+
|
|
107
|
+
Address => ContractName:
|
|
108
|
+
0xb51eaa437AC67A631e2FEca0a18dA7a6391c0D07 SynthereumManager
|
|
109
|
+
|
|
110
|
+
Success.
|
|
111
|
+
|
|
112
|
+
The directory structure looks like this:
|
|
113
|
+
|
|
114
|
+
::
|
|
115
|
+
|
|
116
|
+
[root@hxzy test]# tree
|
|
117
|
+
.
|
|
118
|
+
└── SynthereumManager
|
|
119
|
+
└── deploy
|
|
120
|
+
├── contracts
|
|
121
|
+
│ ├── common
|
|
122
|
+
│ │ └── interfaces
|
|
123
|
+
│ │ └── IEmergencyShutdown.sol
|
|
124
|
+
│ └── core
|
|
125
|
+
│ ├── Constants.sol
|
|
126
|
+
│ ├── Finder.sol
|
|
127
|
+
│ ├── interfaces
|
|
128
|
+
│ │ ├── IFinder.sol
|
|
129
|
+
│ │ └── IManager.sol
|
|
130
|
+
│ └── Manager.sol
|
|
131
|
+
└── @openzeppelin
|
|
132
|
+
└── contracts
|
|
133
|
+
├── access
|
|
134
|
+
│ ├── AccessControlEnumerable.sol
|
|
135
|
+
│ ├── AccessControl.sol
|
|
136
|
+
│ ├── IAccessControlEnumerable.sol
|
|
137
|
+
│ └── IAccessControl.sol
|
|
138
|
+
└── utils
|
|
139
|
+
├── Context.sol
|
|
140
|
+
├── introspection
|
|
141
|
+
│ ├── ERC165.sol
|
|
142
|
+
│ └── IERC165.sol
|
|
143
|
+
├── Strings.sol
|
|
144
|
+
└── structs
|
|
145
|
+
└── EnumerableSet.sol
|
|
146
|
+
|
|
147
|
+
13 directories, 15 files
|
|
148
|
+
|
|
149
|
+
Get code by tx only:
|
|
150
|
+
|
|
151
|
+
::
|
|
152
|
+
|
|
153
|
+
getCode -n eth -t 0x8dda3f4a1c4bbc85ed50d7a78096f805f2c9382e35800e42f066abaa7b17a71b -p 127.0.0.1:7890
|
|
154
|
+
|
|
155
|
+
The address without the corresponding contract name is an unopened contract\EOA.
|
|
156
|
+
|
|
157
|
+
Like this:
|
|
158
|
+
|
|
159
|
+
::
|
|
160
|
+
|
|
161
|
+
[root@hxzy test]#getCode -n eth -t 0x8dda3f4a1c4bbc85ed50d7a78096f805f2c9382e35800e42f066abaa7b17a71b -p 127.0.0.1:7890
|
|
162
|
+
0-0: contract/AnyswapV6ERC20.sol
|
|
163
|
+
1-0: contract/FiatTokenProxy.sol
|
|
164
|
+
2-0: Implementation/FiatTokenV2_1.sol
|
|
165
|
+
3-0: contract/AnyswapV6Router.sol
|
|
166
|
+
4-0: contract/FiatTokenV2_1.sol
|
|
167
|
+
|
|
168
|
+
Address => ContractName:
|
|
169
|
+
0xea928a8d09e11c66e074fbf2f6804e19821f438d AnyswapV6ERC20
|
|
170
|
+
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 FiatTokenProxy
|
|
171
|
+
0xa2327a938febf5fec13bacfb16ae10ecbc4cbdcf FiatTokenV2_1
|
|
172
|
+
0x7782046601e7b9b05ca55a3899780ce6ee6b8b2b AnyswapV6Router
|
|
173
|
+
0xe19105463d6fe2f2bd86c69ad478f4b76ce49c53
|
|
174
|
+
|
|
175
|
+
Proxy => Implementation:
|
|
176
|
+
0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 0xa2327a938febf5fec13bacfb16ae10ecbc4cbdcf
|
|
177
|
+
|
|
178
|
+
Success.
|
|
179
|
+
|
|
180
|
+
If there is a proxy contract, it will be displayed like this:
|
|
181
|
+
|
|
182
|
+
::
|
|
183
|
+
|
|
184
|
+
Proxy => Implementation:
|
|
185
|
+
0xff970a61a04b1ca14834a43f5de4533ebddb5cc8 0x1efb3f88bc88f03fd1804a5c53b7141bbef5ded8
|
|
186
|
+
0x82af49447d8a07e3bd95bd0d56f35241523fbab1 0x8b194beae1d3e0788a1a35173978001acdfba668
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
In particular, the okex related chain needs apikey to use.
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
::
|
|
193
|
+
|
|
194
|
+
[root@hxzy test]#getCode -n okt -p 127.0.0.1:7890 -a 0x0eC4020F29faa430754f1dB07B66798d31006771
|
|
195
|
+
If you want to get the contract code of the okex link, you need to manually enter the api key.
|
|
196
|
+
Visit this link:
|
|
197
|
+
1. okt: https://www.oklink.com/cn/oktc/address/0x38AB5022BEa07AA8966A9bEB5EF7759b715e4BEE
|
|
198
|
+
2. okb: https://www.oklink.com/cn/okbc-test/address/0x6BC26C28130e7634fFa1330969f34e98DC4d0019
|
|
199
|
+
3. okt-testnet: https://www.oklink.com/cn/oktc-test/address/0x7c3ebCB6c4Ae99964980006C61d7eb032eDcb06B
|
|
200
|
+
|
|
201
|
+
Follow the steps below:
|
|
202
|
+
1. Open the above link
|
|
203
|
+
2. Open the browser developer tool
|
|
204
|
+
3. Click the contract tab page on the browser
|
|
205
|
+
4. Find the request "contract?t="
|
|
206
|
+
5. X-Apikey in the request header of the request is the required apikey
|
|
207
|
+
|
|
208
|
+
For example:
|
|
209
|
+
getCode -p 127.0.0.1:7890 -n okt -a 0x38AB5022BEa07AA8966A9bEB5EF7759b715e4BEE --apikey LWIzMWUtNDU0Ny05Mjk5LWI2ZDA3Yjc2MzFhYmEyYzkwM2NjfDI4MDQzNDU3Mjc2NjY0OTI=
|
|
210
|
+
|
|
211
|
+
Parameter description:
|
|
212
|
+
|
|
213
|
+
::
|
|
214
|
+
|
|
215
|
+
optional arguments:
|
|
216
|
+
-h, --help show this help message and exit
|
|
217
|
+
-i INPUTFILE Input file path including contract addresses.
|
|
218
|
+
-o OUTPUTFOLDER Choose a folder to export.
|
|
219
|
+
-a ADDRESS A string including contract addresses.
|
|
220
|
+
-n NETWORK Which network to get source code.
|
|
221
|
+
-k KEY Provide paid api key to download paid-only network code.
|
|
222
|
+
-p PROXY Use a proxy.
|
|
223
|
+
-t TXHASH Get the relevant contract source code in the specified transaction.
|
|
224
|
+
-u Check to see if a new version is available to update.
|
|
225
|
+
-v Show version
|
|
226
|
+
--apikey APIKEY The apikey required by the okex related chain.
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
Contact
|
|
230
|
+
=======
|
|
231
|
+
|
|
232
|
+
If you have any suggestions or needs please contact: support@hxzy.me
|
|
233
|
+
|
|
234
|
+
Github: https://github.com/5hawnXu/getSourceCode
|
|
@@ -11,17 +11,25 @@ Supported Chain Platforms:
|
|
|
11
11
|
|
|
12
12
|
::
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
Ethereum Mainnet | Sepolia Testnet | Hoodi Testnet
|
|
15
|
+
BNB Smart Chain Mainnet | BNB Smart Chain Testnet
|
|
16
|
+
Polygon Mainnet | Polygon Amoy Testnet
|
|
17
|
+
Base Mainnet | Base Sepolia Testnet
|
|
18
|
+
Arbitrum One Mainnet | Arbitrum Sepolia Testnet
|
|
19
|
+
Linea Mainnet | Linea Sepolia Testnet
|
|
20
|
+
Blast Mainnet | Blast Sepolia Testnet
|
|
21
|
+
OP Mainnet | OP Sepolia Testnet
|
|
22
|
+
Avalanche C-Chain | Avalanche Fuji Testnet
|
|
23
|
+
BitTorrent Chain Mainnet | BitTorrent Chain Testnet
|
|
24
|
+
Celo Mainnet | Celo Sepolia Testnet
|
|
25
|
+
Fraxtal Mainnet | Fraxtal Hoodi Testnet
|
|
26
|
+
Gnosis...
|
|
27
|
+
|
|
28
|
+
Chain names are case-insensitive.
|
|
29
|
+
|
|
30
|
+
Some chains (e.g. BNB Smart Chain, Base, OP, Avalanche) require a paid API plan.
|
|
18
31
|
|
|
19
|
-
|
|
20
|
-
baobab|base-testnet|boba-testnet|bsc-testnet
|
|
21
|
-
bttc-testnet|ftm-testnet|goerli|heco-testnet
|
|
22
|
-
linea-testnet|moonbase|opt-testnet|okb
|
|
23
|
-
okt-testnet|opBNB|poly-testnet|poly-zk-testnet
|
|
24
|
-
ronin-testnet|sepolia|zkSyncEra-testnet
|
|
32
|
+
For the full list of supported chains, visit: https://docs.etherscan.io/supported-chains
|
|
25
33
|
|
|
26
34
|
|
|
27
35
|
|
|
@@ -51,7 +59,7 @@ Usage
|
|
|
51
59
|
|
|
52
60
|
::
|
|
53
61
|
|
|
54
|
-
getCode [-h] [-i INPUTFILE] [-o OUTPUTFOLDER] [-a ADDRESS] [-n NETWORK] [-k] [-p PROXY] [-t TXHASH] [-u] [-v] [--apikey APIKEY]
|
|
62
|
+
getCode [-h] [-i INPUTFILE] [-o OUTPUTFOLDER] [-a ADDRESS] [-n NETWORK] [-k KEY] [-p PROXY] [-t TXHASH] [-u] [-v] [--apikey APIKEY]
|
|
55
63
|
|
|
56
64
|
For example:
|
|
57
65
|
|
|
@@ -200,7 +208,7 @@ Parameter description:
|
|
|
200
208
|
-o OUTPUTFOLDER Choose a folder to export.
|
|
201
209
|
-a ADDRESS A string including contract addresses.
|
|
202
210
|
-n NETWORK Which network to get source code.
|
|
203
|
-
-k
|
|
211
|
+
-k KEY Provide paid api key to download paid-only network code.
|
|
204
212
|
-p PROXY Use a proxy.
|
|
205
213
|
-t TXHASH Get the relevant contract source code in the specified transaction.
|
|
206
214
|
-u Check to see if a new version is available to update.
|
|
@@ -5,12 +5,14 @@ from getsourcecode.config import *
|
|
|
5
5
|
from getsourcecode.keys import *
|
|
6
6
|
from getsourcecode.common import *
|
|
7
7
|
import getsourcecode.menu
|
|
8
|
+
import urllib3
|
|
8
9
|
|
|
10
|
+
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
|
9
11
|
# Load config
|
|
10
12
|
parser = menu.argparse_menu()
|
|
11
13
|
|
|
12
14
|
|
|
13
|
-
def get_code(input_file, output_folder, address, network):
|
|
15
|
+
def get_code(input_file, output_folder, address, network, api_key):
|
|
14
16
|
try:
|
|
15
17
|
if network.lower() == "Tron".lower():
|
|
16
18
|
addresses = get_addresses_by_file_or_string(input_file, True, address)
|
|
@@ -31,12 +33,11 @@ def get_code(input_file, output_folder, address, network):
|
|
|
31
33
|
addresses = get_addresses_by_file_or_string(input_file, False, address)
|
|
32
34
|
send_zksync_era(addresses, output_folder, network)
|
|
33
35
|
else:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
raise ValueError("Invalid network")
|
|
36
|
+
if network in paid_only_set and api_key == "":
|
|
37
|
+
raise ValueError("Invalid api key, please privide paid api key")
|
|
37
38
|
addresses = get_addresses_by_file_or_string(input_file, False, address)
|
|
38
39
|
if addresses:
|
|
39
|
-
send_request(addresses, output_folder, network)
|
|
40
|
+
send_request(addresses, output_folder, network, api_key)
|
|
40
41
|
else:
|
|
41
42
|
raise ValueError("Error address")
|
|
42
43
|
except Exception as e:
|
|
@@ -50,11 +51,8 @@ def main():
|
|
|
50
51
|
if parser.update:
|
|
51
52
|
check_update(name, current_version)
|
|
52
53
|
sys.exit(0)
|
|
53
|
-
elif parser.key:
|
|
54
|
-
print_key(parser.network.lower())
|
|
55
|
-
sys.exit(0)
|
|
56
54
|
elif parser.inputFile != "" or parser.address != "":
|
|
57
|
-
get_code(parser.inputFile, parser.outputFolder, parser.address, parser.network.lower())
|
|
55
|
+
get_code(parser.inputFile, parser.outputFolder, parser.address, parser.network.lower(), parser.key)
|
|
58
56
|
elif parser.txhash != "":
|
|
59
57
|
get_addresses_by_tx(parser.txhash, parser.network.lower(), parser.outputFolder)
|
|
60
58
|
else:
|
|
@@ -6,7 +6,7 @@ from distutils.version import StrictVersion
|
|
|
6
6
|
def check_update(package_name, current_version):
|
|
7
7
|
try:
|
|
8
8
|
url = f"https://pypi.org/pypi/{package_name}/json"
|
|
9
|
-
response = requests.get(url, verify=
|
|
9
|
+
response = requests.get(url, verify=False)
|
|
10
10
|
response.raise_for_status()
|
|
11
11
|
data = response.json()
|
|
12
12
|
latest_version = data["info"]["version"]
|
|
@@ -2,10 +2,11 @@ import sys
|
|
|
2
2
|
import os
|
|
3
3
|
import time
|
|
4
4
|
import hashlib
|
|
5
|
+
import traceback
|
|
5
6
|
|
|
6
7
|
# Package base info
|
|
7
8
|
USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
|
|
8
|
-
current_version = "2.0.
|
|
9
|
+
current_version = "2.0.11"
|
|
9
10
|
name = "getsourcecode"
|
|
10
11
|
proxy_contract = {}
|
|
11
12
|
contract_index = 0
|
|
@@ -38,8 +39,7 @@ def get_proxies():
|
|
|
38
39
|
|
|
39
40
|
def handle_exception(e):
|
|
40
41
|
print("--------------------------------------")
|
|
41
|
-
|
|
42
|
-
print("error type:", e)
|
|
42
|
+
traceback.print_exc()
|
|
43
43
|
print("--------------------------------------")
|
|
44
44
|
sys.exit(EXIT_CODE)
|
|
45
45
|
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
class CaseInsensitiveDict(dict):
|
|
2
|
+
def __init__(self, data=None):
|
|
3
|
+
super().__init__()
|
|
4
|
+
if data:
|
|
5
|
+
for key, value in data.items():
|
|
6
|
+
self[key] = value # 走重写的 __setitem__
|
|
7
|
+
|
|
8
|
+
def __setitem__(self, key, value):
|
|
9
|
+
super().__setitem__(key.lower(), value)
|
|
10
|
+
|
|
11
|
+
def __getitem__(self, key):
|
|
12
|
+
return super().__getitem__(key.lower())
|
|
13
|
+
|
|
14
|
+
def __contains__(self, key):
|
|
15
|
+
return super().__contains__(key.lower())
|
|
16
|
+
|
|
17
|
+
def get(self, key, default=None):
|
|
18
|
+
return super().get(key.lower(), default)
|
|
19
|
+
|
|
20
|
+
api_keys = [
|
|
21
|
+
"B69GNP1IXCXJUGTWVCZPW4PS6KFDQ9MNJ1",
|
|
22
|
+
"TRUHXX8K4D5E4665M22FUYZ6F4ZP4SC6UQ",
|
|
23
|
+
"373ZPPAM1QZYS55Q5AW24BKW124BGPMPIA",
|
|
24
|
+
"75FE5RHNXQJPRY6A4EGXTWJKE4M7783W6F",
|
|
25
|
+
"TRUHXX8K4D5E4665M22FUYZ6F4ZP4SC6UQ",
|
|
26
|
+
"Q8K1J5WIXHVQWV1XHVFF1INTPHWFZP5AZV",
|
|
27
|
+
"KWPEX5CZ437P2JRB2U7WZ37VQFAVZFXXP6"
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
req_url = "https://api.etherscan.io/v2/api?module=contract&action=getsourcecode&address="
|
|
31
|
+
|
|
32
|
+
tx_hash_scan_config = {
|
|
33
|
+
'eth': {
|
|
34
|
+
"url": "https://etherscan.io/vmtrace?txhash={}&type=parity#raw",
|
|
35
|
+
"re": r"<preid=\"editor\"class=\"ms-3\">(.*?)</pre>"
|
|
36
|
+
},
|
|
37
|
+
'bsc': {
|
|
38
|
+
"url": "https://www.bscscan.com/vmtrace?txhash={}&type=gethtrace2",
|
|
39
|
+
"re": r"<preid=\"editor\"class=\"ms-3\">(.*?)</pre>"
|
|
40
|
+
},
|
|
41
|
+
'heco': {
|
|
42
|
+
"url": "https://www.hecoinfo.com/api/v1/chain/txs/detail?txHash={}&chainId=HECO",
|
|
43
|
+
"re": ""
|
|
44
|
+
},
|
|
45
|
+
'arbi': {
|
|
46
|
+
"url": "https://arbiscan.io/vmtrace?txhash={}&type=gethtrace2",
|
|
47
|
+
"re": r"<preid='editor'>(.*?)</pre>"
|
|
48
|
+
},
|
|
49
|
+
'boba': {
|
|
50
|
+
"url": "https://bobascan.com/vmtrace?txhash={}&type=gethtrace2",
|
|
51
|
+
"re": r"<preid='editor'>(.*?)</pre>"
|
|
52
|
+
},
|
|
53
|
+
'arbi-nova': {
|
|
54
|
+
"url": "https://nova.arbiscan.io/vmtrace?txhash={}&type=gethtrace2",
|
|
55
|
+
"re": r"<preid='editor'>(.*?)</pre>"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
tenderly_chain_id_list = {
|
|
60
|
+
"arbi": 42161,
|
|
61
|
+
"arbi-testnet": 421613,
|
|
62
|
+
"bsc": 56,
|
|
63
|
+
"bsc-testnet": 97,
|
|
64
|
+
"avax": 43114,
|
|
65
|
+
"avax-testnet": 43113,
|
|
66
|
+
"fantom": 250,
|
|
67
|
+
"ftm-testnet": 25,
|
|
68
|
+
"moonbeam": 1284,
|
|
69
|
+
"moonriver": 1285,
|
|
70
|
+
"cronos": 25,
|
|
71
|
+
"cronos-testnet": 338,
|
|
72
|
+
"boba-testnet": 2888,
|
|
73
|
+
"gnosis": 100,
|
|
74
|
+
"eth": 1,
|
|
75
|
+
"sepolia": 11155111,
|
|
76
|
+
"goerli": 5,
|
|
77
|
+
"poly": 137,
|
|
78
|
+
"poly-testnet": 80001,
|
|
79
|
+
"opt": 10,
|
|
80
|
+
"opt-testnet": 420,
|
|
81
|
+
"base": 8453,
|
|
82
|
+
"base-testnet": 84531,
|
|
83
|
+
"boba": 288
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
special_trace_api = {
|
|
87
|
+
"klaytn": {},
|
|
88
|
+
'ronin': {}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
chain_to_id = CaseInsensitiveDict({
|
|
92
|
+
"Ethereum Mainnet": 1,
|
|
93
|
+
"Sepolia Testnet": 11155111,
|
|
94
|
+
"Hoodi Testnet": 560048,
|
|
95
|
+
"BNB Smart Chain Mainnet": 56,
|
|
96
|
+
"BNB Smart Chain Testnet": 97,
|
|
97
|
+
"Polygon Mainnet": 137,
|
|
98
|
+
"Polygon Amoy Testnet": 80002,
|
|
99
|
+
"Base Mainnet": 8453,
|
|
100
|
+
"Base Sepolia Testnet": 84532,
|
|
101
|
+
"Arbitrum One Mainnet": 42161,
|
|
102
|
+
"Arbitrum Sepolia Testnet": 421614,
|
|
103
|
+
"Linea Mainnet": 59144,
|
|
104
|
+
"Linea Sepolia Testnet": 59141,
|
|
105
|
+
"Blast Mainnet": 81457,
|
|
106
|
+
"Blast Sepolia Testnet": 168587773,
|
|
107
|
+
"OP Mainnet": 10,
|
|
108
|
+
"OP Sepolia Testnet": 11155420,
|
|
109
|
+
"Avalanche C-Chain": 43114,
|
|
110
|
+
"Avalanche Fuji Testnet": 43113,
|
|
111
|
+
"BitTorrent Chain Mainnet": 199,
|
|
112
|
+
"BitTorrent Chain Testnet": 1029,
|
|
113
|
+
"Celo Mainnet": 42220,
|
|
114
|
+
"Celo Sepolia Testnet": 11142220,
|
|
115
|
+
"Fraxtal Mainnet": 252,
|
|
116
|
+
"Fraxtal Hoodi Testnet": 2523,
|
|
117
|
+
"Gnosis": 100,
|
|
118
|
+
"Mantle Mainnet": 5000,
|
|
119
|
+
"Mantle Sepolia Testnet": 5003,
|
|
120
|
+
"Memecore Mainnet": 4352,
|
|
121
|
+
"Memecore Testnet": 43521,
|
|
122
|
+
"Moonbeam Mainnet": 1284,
|
|
123
|
+
"Moonriver Mainnet": 1285,
|
|
124
|
+
"Moonbase Alpha Testnet": 1287,
|
|
125
|
+
"opBNB Mainnet": 204,
|
|
126
|
+
"opBNB Testnet": 5611,
|
|
127
|
+
"Scroll Mainnet": 534352,
|
|
128
|
+
"Scroll Sepolia Testnet": 534351,
|
|
129
|
+
"Taiko Mainnet": 167000,
|
|
130
|
+
"Taiko Hoodi": 167013,
|
|
131
|
+
"XDC Mainnet": 50,
|
|
132
|
+
"XDC Apothem Testnet": 51,
|
|
133
|
+
"ApeChain Mainnet": 33139,
|
|
134
|
+
"ApeChain Curtis Testnet": 33111,
|
|
135
|
+
"World Mainnet": 480,
|
|
136
|
+
"World Sepolia Testnet": 4801,
|
|
137
|
+
"Sonic Mainnet": 146,
|
|
138
|
+
"Sonic Testnet": 14601,
|
|
139
|
+
"Unichain Mainnet": 130,
|
|
140
|
+
"Unichain Sepolia Testnet": 1301,
|
|
141
|
+
"Abstract Mainnet": 2741,
|
|
142
|
+
"Abstract Sepolia Testnet": 11124,
|
|
143
|
+
"Berachain Mainnet": 80094,
|
|
144
|
+
"Berachain Bepolia Testnet": 80069,
|
|
145
|
+
"Swellchain Mainnet": 1923,
|
|
146
|
+
"Swellchain Testnet": 1924,
|
|
147
|
+
"Monad Mainnet": 143,
|
|
148
|
+
"Monad Testnet": 10143,
|
|
149
|
+
"HyperEVM Mainnet": 999,
|
|
150
|
+
"Katana Mainnet": 747474,
|
|
151
|
+
"Katana Bokuto": 737373,
|
|
152
|
+
"Sei Mainnet": 1329,
|
|
153
|
+
"Sei Testnet": 1328,
|
|
154
|
+
"Stable Mainnet": 988,
|
|
155
|
+
"Stable Testnet": 2201,
|
|
156
|
+
"Plasma Mainnet": 9745,
|
|
157
|
+
"Plasma Testnet": 9746,
|
|
158
|
+
"MegaETH Mainnet": 4326,
|
|
159
|
+
"MegaETH Testnet": 6342,
|
|
160
|
+
})
|
|
161
|
+
|
|
162
|
+
paid_only_chains = [
|
|
163
|
+
"BNB Smart Chain Mainnet",
|
|
164
|
+
"BNB Smart Chain Testnet",
|
|
165
|
+
"Base Mainnet",
|
|
166
|
+
"Base Sepolia Testnet",
|
|
167
|
+
"OP Mainnet",
|
|
168
|
+
"OP Sepolia Testnet",
|
|
169
|
+
"Avalanche C-Chain",
|
|
170
|
+
"Avalanche Fuji Testnet",
|
|
171
|
+
]
|
|
172
|
+
|
|
173
|
+
paid_only_set = {c.lower() for c in paid_only_chains}
|
|
174
|
+
|
|
175
|
+
chain_id_to_name = {v: k for k, v in chain_to_id.items()}
|
|
@@ -55,7 +55,7 @@ def get_addresses_by_file_or_string(input_file, is_tron, add_string,):
|
|
|
55
55
|
@retry(stop_max_attempt_number=5, wait_fixed=2000)
|
|
56
56
|
def get_by_tenderly_api_use_retry(tx_hash, proxies, network):
|
|
57
57
|
tenderly_api = f'https://api.tenderly.co/api/v1/public-contract/{tenderly_chain_id_list[network]}/tx/{tx_hash}'
|
|
58
|
-
tenderly_req = requests.get(tenderly_api, proxies=proxies, verify=
|
|
58
|
+
tenderly_req = requests.get(tenderly_api, proxies=proxies, verify=False)
|
|
59
59
|
return tenderly_req.json()['addresses']
|
|
60
60
|
|
|
61
61
|
|
|
@@ -64,7 +64,7 @@ def get_by_scan_use_re_use_retry(url, proxies):
|
|
|
64
64
|
header = {
|
|
65
65
|
"User-Agent": USER_AGENT
|
|
66
66
|
}
|
|
67
|
-
scan_req = requests.get(url, headers=header, proxies=proxies, verify=
|
|
67
|
+
scan_req = requests.get(url, headers=header, proxies=proxies, verify=False)
|
|
68
68
|
return scan_req
|
|
69
69
|
|
|
70
70
|
|
|
@@ -88,7 +88,7 @@ def get_by_scan_use_re(tx_hash, proxies, network):
|
|
|
88
88
|
@retry(stop_max_attempt_number=5, wait_fixed=2000)
|
|
89
89
|
def get_ronin_info_by_api_use_retry(tx_hash, start_index, size, header, proxies):
|
|
90
90
|
ronin_api = f'https://explorerv3-api.roninchain.com/tx/{tx_hash}/internal?from={start_index}&size={size}'
|
|
91
|
-
ronin_req = requests.get(ronin_api, headers=header, proxies=proxies, verify=
|
|
91
|
+
ronin_req = requests.get(ronin_api, headers=header, proxies=proxies, verify=False)
|
|
92
92
|
return ronin_req
|
|
93
93
|
|
|
94
94
|
|
|
@@ -119,14 +119,14 @@ def get_by_special_way_ronin(tx_hash, proxies):
|
|
|
119
119
|
@retry(stop_max_attempt_number=5, wait_fixed=2000)
|
|
120
120
|
def get_klaytn_block_by_api_use_retry(tx_hash, proxies):
|
|
121
121
|
klaytn_block_api = f"https://api-cypress.klaytnscope.com/v2/txs/{tx_hash}"
|
|
122
|
-
klaytn_block_req = requests.get(klaytn_block_api, proxies=proxies, verify=
|
|
122
|
+
klaytn_block_req = requests.get(klaytn_block_api, proxies=proxies, verify=False)
|
|
123
123
|
return klaytn_block_req.json()["result"]["blockNumber"]
|
|
124
124
|
|
|
125
125
|
|
|
126
126
|
@retry(stop_max_attempt_number=5, wait_fixed=2000)
|
|
127
127
|
def get_klaytn_trance_by_api_use_retry(tx_hash, proxies, klaytn_block):
|
|
128
128
|
klaytn_trance_api = f"https://api-cypress.klaytnscope.com/v2/blocks/{klaytn_block}/itxDetail?txHash={tx_hash}"
|
|
129
|
-
klaytn_trance_req = requests.get(klaytn_trance_api, proxies=proxies, verify=
|
|
129
|
+
klaytn_trance_req = requests.get(klaytn_trance_api, proxies=proxies, verify=False)
|
|
130
130
|
return klaytn_trance_req
|
|
131
131
|
|
|
132
132
|
|