|
|
--- |
|
|
license: mit |
|
|
task_categories: |
|
|
- text-generation |
|
|
language: |
|
|
- en |
|
|
tags: |
|
|
- code |
|
|
size_categories: |
|
|
- 1K<n<10K |
|
|
--- |
|
|
|
|
|
This dataset consists of 4,134 unique Solidity files. The files were gathered from three sources: Etherscan, Github and DISL dataset. Six preprocessing steps were applied: |
|
|
|
|
|
- Step 1 "Cleaning": Unnecessary parts such as comments or blank lines were removed from each file. |
|
|
- Step 2 "Formatting": Each file was converted with Prettier (and the corresponding Solidity-plugin) so that the final model only generates code in a correct format. |
|
|
- Step 3 "Slither Analysis": Each file has been checked for security vulnerabilities and gas consumption issues. Annotations are added to the line or construct in which the vulnerability or optimization issue was detected. |
|
|
The entry "secure" is 0 for vulnerable contracts and 1 for secure contracts. The following Solidity code snippet shows an annotation example. The exact position of the vulnerability, the vulnerability and a recommendation how to avoid it are given. |
|
|
```Solidity |
|
|
// WARNING Optimization Issue (immutable-states | ID: 21fb30b): DYORNFA._feeAddrWallet1 should be immutable |
|
|
// Recommendation for 21fb30b: Add the ’immutable’ attribute to state variables that never change or are set only in the constructor. |
|
|
address payable private _feeAddrWallet1; |
|
|
|
|
|
// WARNING Vulnerability (unused-return | severity: Medium | ID: 3032186): AlcoholicApe.createUniswapPair() ignores return value by IERC20(_pair).approve(address(_uniswap),type()(uint256).max) |
|
|
// Recommendation for 3032186: Ensure that all the return values of the function calls are used. |
|
|
function createUniswapPair() external onlyOwner { |
|
|
require(!_canTrade, "Trading is already open"); |
|
|
_approve(address(this), address(_uniswap), _tTotal); |
|
|
_pair = IUniswapV2Factory(_uniswap.factory()).createPair( |
|
|
address(this), |
|
|
_uniswap.WETH() |
|
|
); |
|
|
// unused-return | ID: 3032186 |
|
|
IERC20(_pair).approve(address(_uniswap), type(uint).max); |
|
|
} |
|
|
``` |
|
|
- Step 4 "Splitting": Each file was splitted according to the definitions (i.e. contract, interface or library) it contains. The required imports were added to the splitted files accordingly. |
|
|
- Step 5 "Similarity Check": Duplicate and very similar contracts were removed. |
|
|
- Step 6 "Solhint Fixes": Some of the best practice issues detected by Solhint were fixed in the files. |
|
|
|
|
|
If you wish to use this dataset, you can cite it as follows: |
|
|
```latex |
|
|
@misc{hensel2025preprocessed_solidity_dataset_v1, |
|
|
title = {Preprocessed Solidity Dataset V1 (Without Special Tokens)}, |
|
|
author={Fabian Hensel}, |
|
|
year={2025} |
|
|
} |
|
|
``` |