-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #531 from protofire/autofix-avoid-suicide
added: autofix avoid-suicide
- Loading branch information
Showing
17 changed files
with
253 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"rules": { | ||
"avoid-suicide": "error" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
pragma solidity ^0.8.0; | ||
|
||
import '@openzeppelin/contracts/ownership/Suicide.sol'; | ||
import { feature as suicide} from '@openzeppelin/contracts/ownership/Suicide.sol'; | ||
|
||
uint256 constant suicide = 1; | ||
|
||
enum MyEnum { | ||
suicide, | ||
B | ||
} | ||
|
||
struct OneNiceStruct { | ||
uint256 suicide; | ||
uint256 b; | ||
} | ||
|
||
error Unauthorized(); | ||
|
||
function freeFunction() pure returns (uint256) { | ||
suicide(); | ||
return 1; | ||
} | ||
|
||
contract Generic { | ||
struct AnotherNiceStruct { | ||
uint256 suicide; | ||
uint256 c; | ||
} | ||
|
||
address constant owner = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"; | ||
|
||
function seekAndestroy1() external { | ||
suicide(); | ||
} | ||
|
||
function seekAndestroy2() external { | ||
suicide(owner); | ||
} | ||
|
||
function seekAndestroy3() external { | ||
selfdestruct(); | ||
} | ||
|
||
function seekAndestroy4() external { | ||
selfdestruct(owner); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
pragma solidity ^0.8.0; | ||
|
||
import '@openzeppelin/contracts/ownership/Suicide.sol'; | ||
import { feature as suicide} from '@openzeppelin/contracts/ownership/Suicide.sol'; | ||
|
||
uint256 constant suicide = 1; | ||
|
||
enum MyEnum { | ||
suicide, | ||
B | ||
} | ||
|
||
struct OneNiceStruct { | ||
uint256 suicide; | ||
uint256 b; | ||
} | ||
|
||
error Unauthorized(); | ||
|
||
function freeFunction() pure returns (uint256) { | ||
selfdestruct(); | ||
return 1; | ||
} | ||
|
||
contract Generic { | ||
struct AnotherNiceStruct { | ||
uint256 suicide; | ||
uint256 c; | ||
} | ||
|
||
address constant owner = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"; | ||
|
||
function seekAndestroy1() external { | ||
selfdestruct(); | ||
} | ||
|
||
function seekAndestroy2() external { | ||
selfdestruct(owner); | ||
} | ||
|
||
function seekAndestroy3() external { | ||
selfdestruct(); | ||
} | ||
|
||
function seekAndestroy4() external { | ||
selfdestruct(owner); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
pragma solidity ^0.8.0; | ||
|
||
import '@openzeppelin/contracts/ownership/Suicide.sol'; | ||
import { feature as suicide} from '@openzeppelin/contracts/ownership/Suicide.sol'; | ||
|
||
uint256 constant suicide = 1; | ||
|
||
enum MyEnum { | ||
suicide, | ||
B | ||
} | ||
|
||
struct OneNiceStruct { | ||
uint256 suicide; | ||
uint256 b; | ||
} | ||
|
||
error Unauthorized(); | ||
|
||
function freeFunction() pure returns (uint256) { | ||
suicide(); | ||
return 1; | ||
} | ||
|
||
contract Generic { | ||
struct AnotherNiceStruct { | ||
uint256 suicide; | ||
uint256 c; | ||
} | ||
|
||
address constant owner = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"; | ||
|
||
function seekAndestroy1() external { | ||
suicide(); | ||
} | ||
|
||
function seekAndestroy2() external { | ||
suicide(owner); | ||
} | ||
|
||
function seekAndestroy3() external { | ||
selfdestruct(); | ||
} | ||
|
||
function seekAndestroy4() external { | ||
selfdestruct(owner); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.