mirror of https://github.com/crytic/slither
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.
73 lines
1.2 KiB
73 lines
1.2 KiB
3 years ago
|
pragma solidity ^0.8.4;
|
||
2 years ago
|
interface I {
|
||
|
enum SomeEnum { ONE, TWO, THREE }
|
||
|
error ErrorWithEnum(SomeEnum e);
|
||
|
}
|
||
3 years ago
|
|
||
|
struct St{
|
||
|
uint v;
|
||
|
}
|
||
|
|
||
|
error ErrorSimple();
|
||
|
error ErrorWithArgs(uint, uint);
|
||
|
error ErrorWithStruct(St s);
|
||
|
|
||
2 years ago
|
|
||
|
contract VendingMachine is I {
|
||
3 years ago
|
|
||
|
function err0() public {
|
||
|
revert ErrorSimple();
|
||
|
}
|
||
|
function err1() public {
|
||
|
St memory s;
|
||
|
revert ErrorWithStruct(s);
|
||
|
}
|
||
|
function err2() public{
|
||
|
revert ErrorWithArgs(10+10, 10);
|
||
2 years ago
|
revert ErrorWithArgs(uint(SomeEnum.ONE), uint(SomeEnum.ONE));
|
||
3 years ago
|
}
|
||
|
function err3() public{
|
||
|
revert('test');
|
||
|
}
|
||
2 years ago
|
function err4() public {
|
||
|
revert ErrorWithEnum(SomeEnum.ONE);
|
||
|
}
|
||
3 years ago
|
}
|
||
|
|
||
|
contract A{
|
||
|
|
||
|
error MyError(uint);
|
||
|
function f() public{
|
||
|
revert MyError(2);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
contract B is A{
|
||
|
function g() public{
|
||
|
revert MyError(2);
|
||
|
}
|
||
3 years ago
|
|
||
|
function h() public returns(bytes4){
|
||
|
return MyError.selector;
|
||
|
}
|
||
3 years ago
|
}
|
||
|
|
||
2 years ago
|
contract ContractArgCustomError {
|
||
|
error E(ContractArgCustomError a);
|
||
|
|
||
|
function f() payable external {
|
||
|
g();
|
||
|
}
|
||
|
|
||
|
function g() private {
|
||
|
bool something = h();
|
||
|
if (something) {
|
||
|
revert E(this);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function h() private returns (bool something) {
|
||
|
}
|
||
|
}
|
||
2 years ago
|
|