Running slither-check-erc in a loop doesn't pass the etherscan-apikey
- Dominant language
- Python
- Stars
- 6.4k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
We are running `slither-check-erc` in a loop to find non-compliant erc20 contracts however after the first time it runs, the subsequent requests to etherscan api do not seem to persist the api key, leading to errors.
The script we run is https://github.com/argentlabs/argent-contracts/blob/9618d88eb4fd363af3bbd323471c54ddfc3b1e7b/scripts/validate_erc20.sh#L18
Sample run on a set of contract shows a successful first result followed by `ERROR:CryticCompile:Contract has no public source code`. Note the missing api key in the etherscan url in the logs: `https://api.etherscan.io/api?module=contract&action=getsourcecode&address=0x5dbcf33d8c2e976c6b560249878e6f1491bca25c`
```
0xf43b2f981efc5a611a97951ce4fd7d3bd87f4902
0.5.7
# Check RebalancingSetTokenV3
## Check functions
[✓] totalSupply() is present
[✓] totalSupply() -> () (correct return value)
[✓] totalSupply() is view
[✓] balanceOf(address) is present
[✓] balanceOf(address) -> () (correct return value)
[✓] balanceOf(address) is view
[✓] transfer(address,uint256) is present
[✓] transfer(address,uint256) -> () (correct return value)
[✓] Transfer(address,address,uint256) is emitted
[✓] transferFrom(address,address,uint256) is present
[✓] transferFrom(address,address,uint256) -> () (correct return value)
[✓] Transfer(address,address,uint256) is emitted
[✓] approve(address,uint256) is present
[✓] approve(address,uint256) -> () (correct return value)
[✓] Approval(address,address,uint256) is emitted
[✓] allowance(address,address) is present
[✓] allowance(address,address) -> () (correct return value)
[✓] allowance(address,address) is view
[✓] name() is present
[✓] name() -> () (correct return value)
[✓] name() is view
[✓] symbol() is present
[✓] symbol() -> () (correct return value)
[✓] symbol() is view
[✓] decimals() is present
[✓] decimals() -> () (correct return value)
[✓] decimals() is view
## Check events
[✓] Transfer(address,address,uint256) is present
[✓] parameter 0 is indexed
[✓] parameter 1 is indexed
[✓] Approval(address,address,uint256) is present
[✓] parameter 0 is indexed
[✓] parameter 1 is indexed
[✓] RebalancingSetTokenV3 has increaseAllowance(address,uint256)
0x5dbcf33d8c2e976c6b560249878e6f1491bca25c
0.5.17
ERROR:CryticCompile:Contract has no public source code
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/slither/slither.py", line 74, in __init__
crytic_compile = CryticCompile(target, **kwargs)
File "/usr/local/lib/python3.8/site-packages/crytic_compile/crytic_compile.py", line 123, in __init__
self._compile(**kwargs)
File "/usr/local/lib/python3.8/site-packages/crytic_compile/crytic_compile.py", line 930, in _compile
self._platform.compile(self, **kwargs)
File "/usr/local/lib/python3.8/site-packages/crytic_compile/platform/etherscan.py", line 134, in compile
raise InvalidCompilation("Contract has no public source code: " + etherscan_url)
crytic_compile.platform.exceptions.InvalidCompilation: Contract has no public source code: https://api.etherscan.io/api?module=contract&action=getsourcecode&address=0x5dbcf33d8c2e976c6b560249878e6f1491bca25c
```
Contributor guide
Assessment
This issue has not been assessed yet.