forked from ConsenSysDiligence/mythril
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexceptions.sol
45 lines (33 loc) · 860 Bytes
/
exceptions.sol
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
contract Exceptions {
uint256[8] myarray;
function assert1() public pure {
uint256 i = 1;
assert(i == 0);
}
function assert2() public pure {
uint256 i = 1;
assert(i > 0);
}
function assert3(uint256 input) public pure {
assert(input != 23);
}
function requireisfine(uint256 input) public pure {
require(input != 23);
}
function divisionby0(uint256 input) public pure {
uint256 i = 1/input;
}
function thisisfine(uint256 input) public pure {
if (input > 0) {
uint256 i = 1/input;
}
}
function arrayaccess(uint256 index) public view {
uint256 i = myarray[index];
}
function thisisalsofind(uint256 index) public view {
if (index < 8) {
uint256 i = myarray[index];
}
}
}