Static Analyzer for Solidity
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
slither/tests/detectors/incorrect-modifier/modifier_default.sol

52 lines
902 B

contract Test {
modifier noResult() {
if (false) {_;}
else if (false) {revert();}
else {}
}
modifier goodRevert() {
if (false) _;
revert();
}
modifier goodCode() {
if (false) revert();
_;
}
modifier requireAssertNoResult() {
require(1 == 1);
assert(1 == 1);
if (false) _;
}
modifier requireAssertGood() {
require(1 == 1);
assert(1 == 1);
_;
}
modifier loopsNoResult() {
uint8 i = 0;
// Treated like any other conditional
for(i = 0; i<10; i++) {_;}
while(i < 20) {i++; _;}
// Body is checked
do {
i++;
} while (i < 30);
}
modifier loopGood() {
uint8 i = 0;
// Body is checked
do {
i++;
_;
} while (i < 1);
}
}