├── tests ├── __init__.py ├── test_contracts │ ├── flatten │ │ ├── A.sol │ │ ├── B.sol │ │ ├── C.sol │ │ ├── D.sol │ │ ├── 02 │ │ │ ├── 12_20_Errors.sol │ │ │ ├── 02_20_OnlySourceFunctionality.sol │ │ │ ├── 19_20_IERC165Upgradeable.sol │ │ │ ├── 03_20_SmartApprove.sol │ │ │ ├── 14_20_ContextUpgradeable.sol │ │ │ └── 16_20_ERC165Upgradeable.sol │ │ └── 01 │ │ │ ├── 05_13_ContextUpgradeable.sol │ │ │ ├── 08_13_ERC20PausableUpgradeable.sol │ │ │ ├── 07_13_ERC20BurnableUpgradeable.sol │ │ │ └── 09_13_Initializable.sol │ ├── ms │ │ ├── MultiSourceLib.sol │ │ └── MultiSource.sol │ ├── Test.sol │ ├── FunctionSignature.sol │ ├── test_with_exp_abi.sol │ ├── IntegerOverflow.sol │ ├── unchecked.sol │ └── rubic.hashes.json ├── test_standard_json_parser_function_source.py ├── test_abi.py ├── test_standard_json_parser_v4_contract.py └── test_standard_json_parser_v6_contract.py ├── solc_json_parser ├── __init__.py ├── consts.py ├── version_cfg.py ├── cli.py └── fields.py ├── docs └── img │ ├── compare_param.png │ ├── compare_function.png │ ├── compare_modifier.png │ └── compare_variable.png ├── contracts ├── always_revert.sol ├── dev │ ├── test_literals_base.sol │ ├── fallback04.sol │ ├── 1_VirtualBaseStorage.sol │ ├── utils │ │ └── 1_SecondStorage.sol │ ├── 1_Storage.sol │ ├── fallback.sol │ ├── fallback05.sol │ ├── parent.sol │ ├── test_pc.sol │ ├── 1_BaseStorage_pc.sol │ ├── 1_BaseStorage.sol │ └── test_literals.sol ├── renzec │ ├── 07_140_IRenCrv.sol │ ├── 10_140_IWETH.sol │ ├── 100_140_BadgerBridgeLib.sol │ ├── 73_140_SwapLib.sol │ ├── 116_140_IRenCrvPolygon.sol │ ├── 114_140_PolygonConvertLib.sol │ ├── 16_140_ISett.sol │ ├── 96_140_ArbitrumConvertLib.sol │ ├── 97_140_IRenCrvArbitrum.sol │ ├── 134_140_IWETH.sol │ ├── 13_140_ICurveTricrypto.sol │ ├── 46_140_IConverter.sol │ ├── 137_140_IGatewayToken.sol │ ├── 89_140_ICurveETHUInt256.sol │ ├── 33_140_IZeroMeta.sol │ ├── 11_140_ICurveFi.sol │ ├── 91_140_ZeroControllerTest.sol │ ├── 09_140_IBadgerSettPeak.sol │ ├── 41_140_ZeroUnderwriterLockBytecodeLib.sol │ ├── 88_140_IWETH9.sol │ ├── 56_140_Implementation.sol │ ├── 103_140_ICurveFiAvax.sol │ ├── 119_140_ICurveInt256.sol │ ├── 104_140_ICurveUInt256.sol │ ├── 118_140_ICurveUInt128.sol │ ├── 139_140_BTCVault.sol │ ├── 121_140_ICurveUnderlyingInt128.sol │ ├── 122_140_ICurveUnderlyingInt256.sol │ ├── 115_140_ICurveUnderlyingUInt256.sol │ ├── 120_140_ICurveUnderlyingUInt128.sol │ ├── 93_140_LockForLib.sol │ ├── 34_140_IZeroModule.sol │ ├── 136_140_ControllerReleaserV2.sol │ ├── 55_140_IOneSplitAudit.sol │ ├── 62_140_IController.sol │ ├── 125_140_MemcpyLib.sol │ ├── 45_140_LockForImplLib.sol │ ├── 15_140_IyVault.sol │ ├── 87_140_ICurveInt128.sol │ ├── 68_140_IController.sol │ ├── 05_140_ZeroLib.sol │ ├── 74_140_SwapRelease.sol │ ├── 08_140_SplitSignatureLib.sol │ ├── 111_140_RenZECControllerDeployer.sol │ ├── 105_140_ICurveInt128Avax.sol │ ├── 53_140_IERC165.sol │ ├── 17_140_Math.sol │ ├── 49_140_Context.sol │ ├── 77_140_IMerkleDistributor.sol │ ├── 79_140_Context.sol │ ├── 85_140_BadgerBridgeZeroControllerDeployer.sol │ ├── 123_140_RevertCaptureLib.sol │ ├── 12_140_IGateway.sol │ ├── 29_140_DummyBurnCaller.sol │ ├── 66_140_DummyVault.sol │ ├── 133_140_WrappedNative.sol │ ├── 54_140_ContextUpgradeable.sol │ ├── 126_140_ZeroCurveFactory.sol │ ├── 23_140_IUniswapV3SwapCallback.sol │ ├── 76_140_MerkleProof.sol │ ├── 02_140_IUniswapV2Router02.sol │ ├── 106_140_IJoeRouter02.sol │ ├── 43_140_IStrategy.sol │ ├── 69_140_ICurvePool.sol │ ├── 47_140_ZeroControllerTemplate.sol │ ├── 06_140_IERC2612Permit.sol │ ├── 75_140_ZeroDistributor.sol │ ├── 42_140_IGatewayRegistry.sol │ ├── 51_140_Initializable.sol │ ├── 27_140_Initializable.sol │ ├── 40_140_FactoryLib.sol │ ├── 92_140_ControllerFundsReleaser.sol │ ├── 94_140_FactoryImplLib.sol │ └── 04_140_UniswapV2Library.sol ├── sample_input.json ├── sample_seed_file.json ├── test_abi_encoding.sol ├── standard_json │ ├── main.sol │ ├── b.sol │ └── a.sol ├── address_validation.sol ├── test_false_negative.sol ├── poolsell │ ├── 23_39_IERC20Internal.sol │ ├── 32_39_IERC165.sol │ ├── 10_39_OwnableStorage.sol │ ├── 33_39_ERC1155BaseStorage.sol │ ├── 38_39_AggregatorInterface.sol │ ├── 14_39_IWETH.sol │ ├── 34_39_IERC20Metadata.sol │ ├── 09_39_IERC173.sol │ ├── 04_39_ERC1155EnumerableStorage.sol │ ├── 21_39_IPoolInternal.sol │ ├── 31_39_IERC1155Internal.sol │ ├── 37_39_FeeDiscountStorage.sol │ ├── 39_39_AggregatorV3Interface.sol │ ├── 15_39_IExchangeHelper.sol │ ├── 26_39_IERC1155Enumerable.sol │ ├── 29_39_IERC1155Receiver.sol │ ├── 17_39_IPremiaMining.sol │ ├── 24_39_UintUtils.sol │ ├── 03_39_ABDKMath64x64Token.sol │ ├── 13_39_ERC1155Enumerable.sol │ ├── 35_39_PremiaMiningStorage.sol │ └── 20_39_IPoolEvents.sol ├── buy061.sol ├── buy071.sol ├── buy0817.sol ├── infinite_loop.sol ├── branching_overflow_difficult.sol ├── revert_contract.sol ├── reentrancy_simple.sol ├── parent │ └── parent.sol ├── calls_trace.sol ├── reentrancy_dao.sol ├── assembly_test.sol ├── branching_overflow_medium.sol ├── integer_overflow.sol ├── simple_send.sol ├── branching.sol ├── buy051.sol ├── buy081.sol ├── funpass │ ├── 10_13_IERC1155MetadataURI.sol │ ├── 08_13_Context.sol │ ├── 13_13_IERC165.sol │ ├── 07_13_ERC165.sol │ └── 04_13_ERC1155Supply.sol ├── branching.edited.sol ├── cross_contract_call.sol ├── attacker_template_sensitive.sol ├── integer_overflow_multiple_contract.sol.result.json ├── attacker_template.sol ├── branching_overflow_mixed.sol ├── MockVRFConsumerBase.sol ├── branching_overflow_simple.sol ├── integer_overflow_multitx.sol ├── integer_overflow_multiple_contract.sol └── ether_lotto.sol ├── requirements.txt ├── setup.cfg ├── .gitignore ├── .vscode └── launch.json ├── local ├── 0x9BCb8cE123E4bFA53C2319b12DbFB6F7B7675a30_PoolSell │ ├── 23_39_IERC20Internal.sol │ ├── 32_39_IERC165.sol │ ├── 10_39_OwnableStorage.sol │ ├── 33_39_ERC1155BaseStorage.sol │ ├── 38_39_AggregatorInterface.sol │ ├── 34_39_IERC20Metadata.sol │ ├── 14_39_IWETH.sol │ ├── 09_39_IERC173.sol │ ├── 21_39_IPoolInternal.sol │ ├── 04_39_ERC1155EnumerableStorage.sol │ ├── 31_39_IERC1155Internal.sol │ ├── 37_39_FeeDiscountStorage.sol │ ├── 39_39_AggregatorV3Interface.sol │ ├── 15_39_IExchangeHelper.sol │ ├── 26_39_IERC1155Enumerable.sol │ ├── 29_39_IERC1155Receiver.sol │ ├── 17_39_IPremiaMining.sol │ ├── 24_39_UintUtils.sol │ ├── 03_39_ABDKMath64x64Token.sol │ ├── 13_39_ERC1155Enumerable.sol │ ├── 35_39_PremiaMiningStorage.sol │ └── 20_39_IPoolEvents.sol └── 0x9D3A390c898ECf778288B69ec1f8C6dB543c97e7_FunPass │ ├── 10_13_IERC1155MetadataURI.sol │ ├── 08_13_Context.sol │ ├── 13_13_IERC165.sol │ ├── 07_13_ERC165.sol │ └── 04_13_ERC1155Supply.sol ├── .github └── workflows │ └── develop.yml ├── setup.py └── scripts ├── etherscan_json_to_stanard_json.py └── prepare_solc_binaries.py /tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /solc_json_parser/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /solc_json_parser/consts.py: -------------------------------------------------------------------------------- 1 | DEFAULT_SOLC_VERSION = '0.7.0' 2 | 3 | 4 | -------------------------------------------------------------------------------- /docs/img/compare_param.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sbip-sg/solc-json-parser/HEAD/docs/img/compare_param.png -------------------------------------------------------------------------------- /docs/img/compare_function.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sbip-sg/solc-json-parser/HEAD/docs/img/compare_function.png -------------------------------------------------------------------------------- /docs/img/compare_modifier.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sbip-sg/solc-json-parser/HEAD/docs/img/compare_modifier.png -------------------------------------------------------------------------------- /docs/img/compare_variable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sbip-sg/solc-json-parser/HEAD/docs/img/compare_variable.png -------------------------------------------------------------------------------- /tests/test_contracts/flatten/A.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.7.6; 3 | 4 | contract A{ 5 | 6 | } 7 | -------------------------------------------------------------------------------- /contracts/always_revert.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.7.0; 2 | contract Attacker{ 3 | fallback() external{ 4 | revert(); 5 | } 6 | } -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | addict==2.4.0 2 | py_solc_x==1.1.1 3 | pycryptodome==3.16.0 4 | semantic_version==2.9.0 5 | setuptools>=65.5.1 6 | pytest 7 | -------------------------------------------------------------------------------- /tests/test_contracts/flatten/B.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.7.6; 3 | 4 | import './A.sol'; 5 | 6 | contract B{ 7 | 8 | } 9 | -------------------------------------------------------------------------------- /contracts/dev/test_literals_base.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.7.0; 2 | 3 | contract BaseTest{ 4 | string public d = "Hello"; 5 | string public e = "ac43fe"; 6 | } -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [flake8] 2 | extend-ignore = H101,H202,H233,H301,H306,H401,H403,H404,H405,H501,E501,E722,F401,E222,F403,E261,E302,E301, W293, E221, E303, E231, D101, D400, D300, -------------------------------------------------------------------------------- /contracts/renzec/07_140_IRenCrv.sol: -------------------------------------------------------------------------------- 1 | interface IRenCrv { 2 | function exchange( 3 | int128 i, 4 | int128 j, 5 | uint256 dx, 6 | uint256 min_dy 7 | ) external; 8 | } -------------------------------------------------------------------------------- /contracts/renzec/10_140_IWETH.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity >=0.5.0 <0.8.0; 4 | 5 | interface IWETH { 6 | function withdraw(uint256) external; 7 | } -------------------------------------------------------------------------------- /tests/test_contracts/flatten/C.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.7.6; 3 | 4 | import './A.sol'; 5 | import './B.sol'; 6 | 7 | contract C{ 8 | 9 | } 10 | -------------------------------------------------------------------------------- /contracts/sample_input.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "function": "deposit", 4 | "input": [100] 5 | }, 6 | { 7 | "function": "withdrawAll", 8 | "input": [] 9 | } 10 | ] 11 | -------------------------------------------------------------------------------- /contracts/renzec/100_140_BadgerBridgeLib.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | library BadgerBridgeLib { 4 | struct ConvertRecord { 5 | uint128 when; 6 | uint128 qty; 7 | } 8 | } -------------------------------------------------------------------------------- /contracts/renzec/73_140_SwapLib.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | library SwapLib { 4 | struct SwapRecord { 5 | address token; 6 | uint64 when; 7 | uint256 qty; 8 | } 9 | } -------------------------------------------------------------------------------- /contracts/renzec/116_140_IRenCrvPolygon.sol: -------------------------------------------------------------------------------- 1 | interface IRenCrvPolygon { 2 | function exchange( 3 | int128 i, 4 | int128 j, 5 | uint256 dx, 6 | uint256 min_dy 7 | ) external returns (uint256); 8 | } -------------------------------------------------------------------------------- /contracts/renzec/114_140_PolygonConvertLib.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | library PolygonConvertLib { 4 | struct ConvertRecord { 5 | uint64 when; 6 | uint256 qtyETH; 7 | uint256 qty; 8 | } 9 | } -------------------------------------------------------------------------------- /contracts/renzec/16_140_ISett.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity >=0.6.0; 4 | 5 | interface ISett { 6 | function deposit(uint256) external; 7 | 8 | function withdraw(uint256) external; 9 | } -------------------------------------------------------------------------------- /contracts/renzec/96_140_ArbitrumConvertLib.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | library ArbitrumConvertLib { 4 | struct ConvertRecord { 5 | uint256 when; 6 | uint256 qty; 7 | uint256 qtyETH; 8 | } 9 | } -------------------------------------------------------------------------------- /tests/test_contracts/flatten/D.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.7.6; 3 | 4 | import './A.sol'; 5 | import { 6 | B, 7 | C 8 | } from './C.sol'; 9 | 10 | contract D{ 11 | 12 | } 13 | -------------------------------------------------------------------------------- /contracts/renzec/97_140_IRenCrvArbitrum.sol: -------------------------------------------------------------------------------- 1 | interface IRenCrvArbitrum { 2 | function exchange( 3 | int128 i, 4 | int128 j, 5 | uint256 dx, 6 | uint256 min_dy, 7 | address recipient 8 | ) external returns (uint256); 9 | } -------------------------------------------------------------------------------- /contracts/renzec/134_140_IWETH.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.5.0; 2 | 3 | interface IWETH { 4 | function deposit() external payable; 5 | function transfer(address to, uint value) external returns (bool); 6 | function withdraw(uint) external; 7 | } -------------------------------------------------------------------------------- /contracts/sample_seed_file.json: -------------------------------------------------------------------------------- 1 | { 2 | "seed": { 3 | "int": [1, 32768], 4 | "string": ["test string", "test string 2"], 5 | "bytes": ["abcd", "ijlkmn"] 6 | }, 7 | "constructor_args": { 8 | "Test": [0, 0] 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /contracts/renzec/13_140_ICurveTricrypto.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.6.0 <0.8.0; 2 | 3 | interface ICurveTricrypto { 4 | function exchange( 5 | uint256 i, 6 | uint256 j, 7 | uint256 dx, 8 | uint256 min_dy, 9 | bool use_eth 10 | ) external payable; 11 | } -------------------------------------------------------------------------------- /contracts/renzec/46_140_IConverter.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity >=0.5.0 <0.8.0; 4 | 5 | interface IConverter { 6 | function convert(address) external returns (uint256); 7 | 8 | function estimate(uint256) external view returns (uint256); 9 | } -------------------------------------------------------------------------------- /contracts/renzec/137_140_IGatewayToken.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity >=0.6.0 <0.8.0; 3 | 4 | import { IERC20 } from "./25_140_IERC20.sol"; 5 | 6 | abstract contract IGatewayToken is IERC20 { 7 | function fromUnderlying(uint256) external view virtual returns (uint256); 8 | } -------------------------------------------------------------------------------- /contracts/renzec/89_140_ICurveETHUInt256.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.6.0 <0.8.0; 2 | 3 | interface ICurveETHUInt256 { 4 | function exchange( 5 | uint256 i, 6 | uint256 j, 7 | uint256 dx, 8 | uint256 min_dy, 9 | bool use_eth 10 | ) external payable returns (uint256); 11 | } -------------------------------------------------------------------------------- /contracts/renzec/33_140_IZeroMeta.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.6.0; 2 | 3 | interface IZeroMeta { 4 | function receiveMeta( 5 | address from, 6 | address asset, 7 | uint256 nonce, 8 | bytes memory data 9 | ) external; 10 | 11 | function repayMeta(uint256 value) external; 12 | } -------------------------------------------------------------------------------- /contracts/test_abi_encoding.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.7.0; 2 | 3 | contract IntegerOverflowAdd { 4 | uint global_state = 2**256-100; 5 | function test(uint a, uint[12] memory b , bytes8 c, bytes memory d, bytes8[3] memory de, address[2] memory gh ) public{ 6 | global_state = global_state + 2000; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # ignore mac files 2 | *.DS_Store 3 | 4 | # ignore vscode files 5 | .vscode 6 | 7 | __pycache__ 8 | 9 | solc_json_ast/*.json 10 | parsed_json/*.json 11 | 12 | .idea 13 | ref.py 14 | __pycache__/* 15 | /.eggs/ 16 | /solc_json_parser.egg-info/ 17 | /node_modules/ 18 | 19 | /build/ 20 | /dist/ 21 | -------------------------------------------------------------------------------- /solc_json_parser/version_cfg.py: -------------------------------------------------------------------------------- 1 | import addict 2 | 3 | v_keys = addict.Dict() 4 | 5 | v_keys.v8.name = "nodeType" 6 | v_keys.v8.children = "nodes" 7 | 8 | 9 | v_keys.v5.name = "name" 10 | v_keys.v5.children = "children" 11 | 12 | 13 | v_keys.v6 = v_keys.v5 14 | v_keys.v7 = v_keys.v5 15 | v_keys.v4 = v_keys.v5 -------------------------------------------------------------------------------- /contracts/standard_json/main.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.7.0; 4 | 5 | import "./a.sol"; 6 | import "./b.sol"; 7 | 8 | contract Main is A, B{ 9 | A a; 10 | function proxy_add(uint256 i) public payable returns (uint256) { 11 | return add_overflow(i); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /contracts/renzec/11_140_ICurveFi.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity >=0.6.0; 3 | 4 | interface ICurveFi { 5 | function add_liquidity(uint256[2] calldata amounts, uint256 idx) external; 6 | 7 | function remove_liquidity_one_coin( 8 | uint256, 9 | int128, 10 | uint256 11 | ) external; 12 | } -------------------------------------------------------------------------------- /contracts/renzec/91_140_ZeroControllerTest.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.6.0; 2 | 3 | import { ZeroControllerTemplate } from "./47_140_ZeroControllerTemplate.sol"; 4 | 5 | contract ZeroControllerTest is ZeroControllerTemplate { 6 | function approveModule(address module, bool flag) public { 7 | approvedModules[module] = flag; 8 | } 9 | } -------------------------------------------------------------------------------- /contracts/dev/fallback04.sol: -------------------------------------------------------------------------------- 1 | // contracts/Fallback.sol 2 | // SPDX-License-Identifier: Academic Free License v1.1 3 | 4 | pragma solidity ^0.5.0; 5 | 6 | contract Fallback { 7 | 8 | function() external {x=1;} 9 | function receive() external payable {} 10 | function fallback() external payable {} 11 | uint x; 12 | 13 | } -------------------------------------------------------------------------------- /contracts/dev/1_VirtualBaseStorage.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.23; 2 | 3 | abstract contract BaseStorage { 4 | uint256 some; 5 | uint256 number; 6 | 7 | function store(uint256 num) public { 8 | number = num; 9 | } 10 | 11 | function retrieve() public view returns (uint256){ 12 | return number; 13 | } 14 | } -------------------------------------------------------------------------------- /contracts/dev/utils/1_SecondStorage.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.23; 2 | 3 | abstract contract SecondStorage { 4 | uint256 number_sec; 5 | 6 | function store_sec(uint256 num) public { 7 | number_sec = num; 8 | } 9 | 10 | function retrieve_sec() public view returns (uint256){ 11 | return number_sec; 12 | } 13 | } -------------------------------------------------------------------------------- /contracts/renzec/09_140_IBadgerSettPeak.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity >=0.6.0; 4 | 5 | interface IBadgerSettPeak { 6 | function mint( 7 | uint256, 8 | uint256, 9 | bytes32[] calldata 10 | ) external returns (uint256); 11 | 12 | function redeem(uint256, uint256) external returns (uint256); 13 | } -------------------------------------------------------------------------------- /contracts/renzec/41_140_ZeroUnderwriterLockBytecodeLib.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | import { ZeroUnderwriterLock } from "./35_140_ZeroUnderwriterLock.sol"; 4 | 5 | library ZeroUnderwriterLockBytecodeLib { 6 | function get() external pure returns (bytes memory result) { 7 | result = type(ZeroUnderwriterLock).creationCode; 8 | } 9 | } -------------------------------------------------------------------------------- /contracts/dev/1_Storage.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | 3 | pragma solidity 0.8.17; 4 | 5 | 6 | contract Storage { 7 | 8 | uint256 number; 9 | 10 | function store(uint256 num) public { 11 | number = num; 12 | } 13 | 14 | function retrieve() public view returns (uint256){ 15 | return number; 16 | } 17 | 18 | } -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | 5 | { 6 | "name": "Python: Current File", 7 | "type": "python", 8 | "request": "launch", 9 | "program": "${file}", 10 | "console": "integratedTerminal", 11 | "justMyCode": true, 12 | } 13 | ] 14 | } -------------------------------------------------------------------------------- /contracts/address_validation.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.7.0; 2 | 3 | contract Test { 4 | function test2(address a) internal returns (bool){ 5 | require(a!=address(0)); 6 | return true; 7 | } 8 | address admin; 9 | function test(address a) public{ 10 | test2(a); 11 | admin = a; 12 | } 13 | function test3(address a) public { 14 | admin = a; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /contracts/test_false_negative.sol: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | contract example { 5 | // Process state 6 | function get_pid_state(uint64 _pid) public returns (uint64) { 7 | uint64 n = 8; 8 | for (uint16 i = 1; i < 4; ++i) { 9 | if ((i % 3) == 0) { 10 | n *= _pid / uint64(i); 11 | } else { 12 | n /= 3; 13 | } 14 | } 15 | return n % uint64(5); 16 | } 17 | 18 | } -------------------------------------------------------------------------------- /contracts/standard_json/b.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.7.0; 4 | 5 | abstract contract B{ 6 | function deposit() public payable{ 7 | 8 | } 9 | function withdraw () public{ 10 | uint temp_ = block.timestamp; 11 | address payable sender = payable(msg.sender); 12 | sender.call(abi.encodeWithSignature("myFunction(uint)", 10)); 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /contracts/renzec/88_140_IWETH9.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-2.0-or-later 2 | pragma solidity =0.7.6; 3 | 4 | import './25_140_IERC20.sol'; 5 | 6 | /// @title Interface for WETH9 7 | interface IWETH9 is IERC20 { 8 | /// @notice Deposit ether to get wrapped ether 9 | function deposit() external payable; 10 | 11 | /// @notice Withdraw wrapped ether to get ether 12 | function withdraw(uint256) external; 13 | } -------------------------------------------------------------------------------- /contracts/renzec/56_140_Implementation.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity >=0.5.0 <0.8.0; 3 | 4 | /** 5 | @title must be inherited by a contract that will be deployed with ZeroFactoryLib 6 | @author raymondpulver 7 | */ 8 | abstract contract Implementation { 9 | /** 10 | @notice ensure the contract cannot be initialized twice 11 | */ 12 | function lock() public virtual { 13 | // no other logic 14 | } 15 | } -------------------------------------------------------------------------------- /contracts/renzec/103_140_ICurveFiAvax.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity >=0.6.0; 3 | 4 | interface ICurveFi { 5 | function add_liquidity( 6 | uint256[3] calldata amounts, 7 | uint256 min_amount, 8 | bool use_underlying 9 | ) external returns (uint256); 10 | 11 | function remove_liquidity_one_coin( 12 | uint256, 13 | int128, 14 | uint256, 15 | bool 16 | ) external returns (uint256); 17 | } -------------------------------------------------------------------------------- /contracts/dev/fallback.sol: -------------------------------------------------------------------------------- 1 | // contracts/Fallback.sol 2 | // SPDX-License-Identifier: Academic Free License v1.1 3 | 4 | pragma solidity 0.7.0; 5 | 6 | contract Fallback { 7 | receive() external payable{} 8 | function receive() external payable{} 9 | function fallback() external payable{} 10 | fallback() external{ 11 | address payable to = payable(msg.sender); 12 | to.transfer(address(this).balance); 13 | } 14 | } -------------------------------------------------------------------------------- /contracts/poolsell/23_39_IERC20Internal.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | /** 6 | * @title Partial ERC20 interface needed by internal functions 7 | */ 8 | interface IERC20Internal { 9 | event Transfer(address indexed from, address indexed to, uint256 value); 10 | 11 | event Approval( 12 | address indexed owner, 13 | address indexed spender, 14 | uint256 value 15 | ); 16 | } -------------------------------------------------------------------------------- /contracts/renzec/119_140_ICurveInt256.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity >=0.7.0 <0.8.0; 4 | 5 | interface ICurveInt256 { 6 | function get_dy( 7 | int256, 8 | int256, 9 | uint256 10 | ) external view returns (uint256); 11 | 12 | function exchange( 13 | int256, 14 | int256, 15 | uint256, 16 | uint256 17 | ) external returns (uint256); 18 | 19 | function coins(int256) external view returns (address); 20 | } -------------------------------------------------------------------------------- /tests/test_contracts/ms/MultiSourceLib.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity 0.7.0; 4 | 5 | library MultiSourceLib{ 6 | function unsafeAdd(uint256 x, uint256 y) public pure returns (uint256){ 7 | return x + y; 8 | } 9 | } 10 | 11 | 12 | contract MultiSourceUtils{ 13 | uint256 d; 14 | function unsafeAdd(uint256 x, uint256 y) public returns (uint256){ 15 | d = x + y; 16 | return d; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /contracts/buy061.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.6.1; 2 | 3 | contract Buy { 4 | mapping(address => uint256) public balances; 5 | 6 | address payable wallet; 7 | 8 | constructor(address payable _wallet) public { 9 | wallet = _wallet; 10 | } 11 | 12 | 13 | function buyToken() public payable { 14 | // buy a token 15 | balances[msg.sender] += 1; 16 | wallet.transfer(msg.value); 17 | // send ether to the wallet 18 | } 19 | } -------------------------------------------------------------------------------- /contracts/buy071.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.7.1; 2 | 3 | contract Buy { 4 | mapping(address => uint256) public balances; 5 | 6 | address payable wallet; 7 | 8 | constructor(address payable _wallet) public { 9 | wallet = _wallet; 10 | } 11 | 12 | 13 | function buyToken() public payable { 14 | // buy a token 15 | balances[msg.sender] += 1; 16 | wallet.transfer(msg.value); 17 | // send ether to the wallet 18 | } 19 | } -------------------------------------------------------------------------------- /contracts/buy0817.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.8.17; 2 | 3 | contract Buy { 4 | mapping(address => uint256) public balances; 5 | 6 | address payable wallet; 7 | 8 | constructor(address payable _wallet) public { 9 | wallet = _wallet; 10 | } 11 | 12 | 13 | function buyToken() public payable { 14 | // buy a token 15 | balances[msg.sender] += 1; 16 | wallet.transfer(msg.value); 17 | // send ether to the wallet 18 | } 19 | } -------------------------------------------------------------------------------- /contracts/renzec/104_140_ICurveUInt256.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity >=0.7.0 <0.8.0; 4 | 5 | interface ICurveUInt256 { 6 | function get_dy( 7 | uint256, 8 | uint256, 9 | uint256 10 | ) external view returns (uint256); 11 | 12 | function exchange( 13 | uint256, 14 | uint256, 15 | uint256, 16 | uint256 17 | ) external returns (uint256); 18 | 19 | function coins(uint256) external view returns (address); 20 | } -------------------------------------------------------------------------------- /contracts/renzec/118_140_ICurveUInt128.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity >=0.7.0 <0.8.0; 4 | 5 | interface ICurveUInt128 { 6 | function get_dy( 7 | uint128, 8 | uint128, 9 | uint256 10 | ) external view returns (uint256); 11 | 12 | function exchange( 13 | uint128, 14 | uint128, 15 | uint256, 16 | uint256 17 | ) external returns (uint256); 18 | 19 | function coins(uint128) external view returns (address); 20 | } -------------------------------------------------------------------------------- /contracts/dev/fallback05.sol: -------------------------------------------------------------------------------- 1 | // contracts/Fallback.sol 2 | // SPDX-License-Identifier: Academic Free License v1.1 3 | 4 | pragma solidity ^0.5.0; 5 | 6 | contract Fallback { 7 | 8 | function() external {x=1;} 9 | function receive() external payable {} 10 | function fallback() external payable {} 11 | uint x; 12 | // fallback() external{ 13 | // address payable to = payable(msg.sender); 14 | // to.transfer(address(this).balance); 15 | // } 16 | } -------------------------------------------------------------------------------- /contracts/infinite_loop.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.7.0; 2 | contract Test { 3 | int a; 4 | function test1 (int input) public returns(int){ 5 | while(true){ 6 | a = a+1; 7 | address(0xfD36E2c2a6789Db23113685031d7F16329158384).call(""); 8 | } 9 | } 10 | } 11 | 12 | contract Test2 { 13 | int a; 14 | function test1 (int input) public returns(int){ 15 | while(true){ 16 | a = a+1; 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /contracts/renzec/139_140_BTCVault.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity >=0.7.0 <0.8.0; 3 | 4 | import { yVaultUpgradeable } from "./60_140_yVaultUpgradeable.sol"; 5 | 6 | contract BTCVault is yVaultUpgradeable { 7 | function initialize( 8 | address _token, 9 | address _controller, 10 | string memory _name, 11 | string memory _symbol 12 | ) public initializer { 13 | __yVault_init_unchained(_token, _controller, _name, _symbol); 14 | } 15 | } -------------------------------------------------------------------------------- /local/0x9BCb8cE123E4bFA53C2319b12DbFB6F7B7675a30_PoolSell/23_39_IERC20Internal.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | /** 6 | * @title Partial ERC20 interface needed by internal functions 7 | */ 8 | interface IERC20Internal { 9 | event Transfer(address indexed from, address indexed to, uint256 value); 10 | 11 | event Approval( 12 | address indexed owner, 13 | address indexed spender, 14 | uint256 value 15 | ); 16 | } -------------------------------------------------------------------------------- /contracts/branching_overflow_difficult.sol: -------------------------------------------------------------------------------- 1 | //Single transaction overflow 2 | //Post-transaction effect: overflow escapes to publicly-readable storage 3 | 4 | pragma solidity ^0.7.0; 5 | 6 | contract Branching { 7 | uint256 public count = 2**256-1000; 8 | uint256 temp = 0; 9 | 10 | function add_overflow(uint256 input) public { 11 | //0 12 | if (input == 654321){ 13 | 14 | count = count + input; 15 | } 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /contracts/renzec/121_140_ICurveUnderlyingInt128.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity >=0.7.0 <0.8.0; 4 | 5 | interface ICurveUnderlyingInt128 { 6 | function get_dy_underlying( 7 | int128, 8 | int128, 9 | uint256 10 | ) external view returns (uint256); 11 | 12 | function exchange_underlying( 13 | int128, 14 | int128, 15 | uint256, 16 | uint256 17 | ) external returns (uint256); 18 | 19 | function underlying_coins(int128) external view returns (address); 20 | } -------------------------------------------------------------------------------- /contracts/renzec/122_140_ICurveUnderlyingInt256.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity >=0.7.0 <0.8.0; 4 | 5 | interface ICurveUnderlyingInt256 { 6 | function get_dy_underlying( 7 | int256, 8 | int256, 9 | uint256 10 | ) external view returns (uint256); 11 | 12 | function exchange_underlying( 13 | int256, 14 | int256, 15 | uint256, 16 | uint256 17 | ) external returns (uint256); 18 | 19 | function underlying_coins(int256) external view returns (address); 20 | } -------------------------------------------------------------------------------- /contracts/renzec/115_140_ICurveUnderlyingUInt256.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity >=0.7.0 <0.8.0; 4 | 5 | interface ICurveUnderlyingUInt256 { 6 | function get_dy_underlying( 7 | uint256, 8 | uint256, 9 | uint256 10 | ) external view returns (uint256); 11 | 12 | function exchange_underlying( 13 | uint256, 14 | uint256, 15 | uint256, 16 | uint256 17 | ) external returns (uint256); 18 | 19 | function underlying_coins(uint256) external view returns (address); 20 | } -------------------------------------------------------------------------------- /contracts/renzec/120_140_ICurveUnderlyingUInt128.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity >=0.7.0 <0.8.0; 4 | 5 | interface ICurveUnderlyingUInt128 { 6 | function get_dy_underlying( 7 | uint128, 8 | uint128, 9 | uint256 10 | ) external view returns (uint256); 11 | 12 | function exchange_underlying( 13 | uint128, 14 | uint128, 15 | uint256, 16 | uint256 17 | ) external returns (uint256); 18 | 19 | function underlying_coins(uint128) external view returns (address); 20 | } -------------------------------------------------------------------------------- /contracts/revert_contract.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.6.1; 2 | 3 | contract RevertContract { 4 | uint256 level = 0; 5 | 6 | function testRevert(uint256 x) public returns(uint256){ 7 | require(x < 1000, "REQUIRE: Input valuee is too large"); 8 | level += 1; 9 | return x + 108928293 - level; 10 | } 11 | 12 | 13 | function testAssert(uint256 x) public returns(uint256){ 14 | assert(x < 500); 15 | level += 1; 16 | return x + 8928293 - level; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /tests/test_contracts/flatten/02/12_20_Errors.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.4; 4 | 5 | error NotAnAdmin(); 6 | error NotAManager(); 7 | error NotARelayer(); 8 | error OnlyEOA(); 9 | error FeeTooHigh(); 10 | error ShareTooHigh(); 11 | error ZeroAddress(); 12 | error ZeroAmount(); 13 | error InefficientFixedFee(); 14 | error ApproveFailed(); 15 | error MinMustBeLowerThanMax(); 16 | error MaxMustBeBiggerThanMin(); 17 | error CantSetToNull(); 18 | error Unchangeable(); 19 | error LengthMismatch(); -------------------------------------------------------------------------------- /contracts/dev/parent.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity >=0.4.23; 4 | 5 | contract BugC{ 6 | mapping (address => uint) credit; 7 | uint balance; 8 | 9 | function test4(address a) public { 10 | uint oCredit = credit[msg.sender]; 11 | if (oCredit > 0) { 12 | balance -= oCredit; 13 | credit[msg.sender] = 0; 14 | } 15 | } 16 | 17 | function get_balance() public view returns (uint){ 18 | return 100; 19 | } 20 | } 21 | 22 | -------------------------------------------------------------------------------- /contracts/reentrancy_simple.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0.7.0; 2 | contract Reentrance { 3 | mapping (address => uint) balances; 4 | uint public level = 100; 5 | 6 | function deposit () public payable{ 7 | level++; 8 | } 9 | 10 | function withdraw(uint _amount) public { 11 | if (_amount > level){ 12 | // level = (2**256 - 100) + level; 13 | (bool result,) = msg.sender.call{value:_amount}(""); 14 | require(result); 15 | } 16 | } 17 | 18 | } 19 | 20 | -------------------------------------------------------------------------------- /contracts/parent/parent.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity >=0.4.23; 4 | 5 | contract BugC{ 6 | mapping (address => uint) credit; 7 | uint balance; 8 | 9 | function test4(address a) public { 10 | uint oCredit = credit[msg.sender]; 11 | if (oCredit > 0) { 12 | balance -= oCredit; 13 | credit[msg.sender] = 0; 14 | } 15 | } 16 | 17 | function get_balance() public view returns (uint){ 18 | return 100; 19 | } 20 | } 21 | 22 | -------------------------------------------------------------------------------- /tests/test_contracts/Test.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.8.0; 2 | contract Test { 3 | int a; 4 | mapping (address => bool) test; 5 | receive() external payable{ 6 | 7 | } 8 | function bug(address[10] memory input) public { 9 | for(uint i=0; i