forked from crytic/crytic-compile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathci_test_etherscan.sh
executable file
·132 lines (103 loc) · 3.12 KB
/
ci_test_etherscan.sh
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
#!/usr/bin/env bash
### Test etherscan integration
DIR=$(mktemp -d)
cd "$DIR" || exit 255
solc-select use 0.4.25 --always-install
delay_etherscan () {
# Perform a small sleep when API key is not available (e.g. on PR CI from external contributor)
if [ "$GITHUB_ETHERSCAN" = "" ]; then
sleep 5s
else
# Always sleep 2 second in the CI
# We have a lot of concurrent github action so this is needed
sleep 2s
fi
}
echo "::group::Etherscan mainnet"
crytic-compile 0x7F37f78cBD74481E593F9C737776F7113d76B315 --compile-remove-metadata --etherscan-apikey "$GITHUB_ETHERSCAN"
if [ $? -ne 0 ]
then
echo "Etherscan mainnet test failed"
exit 255
fi
echo "::endgroup::"
delay_etherscan
# From crytic/slither#1154
echo "::group::Etherscan #3"
crytic-compile 0xcfc1E0968CA08aEe88CbF664D4A1f8B881d90f37 --compile-remove-metadata --etherscan-apikey "$GITHUB_ETHERSCAN"
if [ $? -ne 0 ]
then
echo "Etherscan #3 test failed"
exit 255
fi
echo "::endgroup::"
delay_etherscan
# From crytic/crytic-compile#415
echo "::group::Etherscan #4"
crytic-compile 0x19c7d0fbf906c282dedb5543d098f43dfe9f856f --compile-remove-metadata --etherscan-apikey "$GITHUB_ETHERSCAN"
if [ $? -ne 0 ]
then
echo "Etherscan #4 test failed"
exit 255
fi
echo "::endgroup::"
delay_etherscan
# From crytic/crytic-compile#150
echo "::group::Etherscan #5"
crytic-compile 0x2a311e451491091d2a1d3c43f4f5744bdb4e773a --compile-remove-metadata --etherscan-apikey "$GITHUB_ETHERSCAN"
if [ $? -ne 0 ]
then
echo "Etherscan #5 test failed"
case "$(uname -sr)" in
CYGWIN*|MINGW*|MSYS*)
echo "This test is known to fail on Windows"
;;
*)
exit 255
;;
esac
fi
echo "::endgroup::"
delay_etherscan
# From crytic/crytic-compile#151
echo "::group::Etherscan #6"
crytic-compile 0x4c808e3c011514d5016536af11218eec537eb6f5 --compile-remove-metadata --etherscan-apikey "$GITHUB_ETHERSCAN"
if [ $? -ne 0 ]
then
echo "Etherscan #6 test failed"
exit 255
fi
echo "::endgroup::"
delay_etherscan
# via-ir test for crytic/crytic-compile#517
echo "::group::Etherscan #7"
crytic-compile 0x9AB6b21cDF116f611110b048987E58894786C244 --compile-remove-metadata --etherscan-apikey "$GITHUB_ETHERSCAN"
if [ $? -ne 0 ]
then
echo "Etherscan #7 test failed"
exit 255
fi
echo "::endgroup::"
# From crytic/crytic-compile#544
echo "::group::Etherscan #8"
crytic-compile 0x9AB6b21cDF116f611110b048987E58894786C244 --etherscan-apikey "$GITHUB_ETHERSCAN"
if [ $? -ne 0 ]
then
echo "Etherscan #8 test failed"
exit 255
fi
dir_name=$(find crytic-export/etherscan-contracts/ -type d -name "*0x9AB6b21cDF116f611110b048987E58894786C244*" -print -quit)
cd "$dir_name" || { echo "Failed to change directory"; exit 255; }
if [ ! -f crytic_compile.config.json ]; then
echo "crytic_compile.config.json does not exist"
exit 255
fi
# TODO: Globbing at crytic_compile.py:720 to run with '.'
crytic-compile 'contracts/InterestRates/InterestRatePositionManager.f.sol' --config-file crytic_compile.config.json
if [ $? -ne 0 ]
then
echo "crytic-compile command failed"
exit 255
fi
cd ../../../
echo "::endgroup::"