diff --git a/.github/workflows/ci-fork-mode.yml b/.github/workflows/ci-fork-mode.yml index 268051c..5e586aa 100644 --- a/.github/workflows/ci-fork-mode.yml +++ b/.github/workflows/ci-fork-mode.yml @@ -15,25 +15,25 @@ jobs: matrix: include: - name: Safemoon - args: 0x0296201bfdfb410c29ef30bcae1b395537aeeb31 0xEb11a0a0beF1AC028B8C2d4CD64138DD5938cA7A -p 0x42981d0bfbAf196529376EE702F2a9Eb9092fcB5 -n bsc -v 0.8.11 + args: 0x0296201bfdfb410c29ef30bcae1b395537aeeb31 0xEb11a0a0beF1AC028B8C2d4CD64138DD5938cA7A -p 0x42981d0bfbAf196529376EE702F2a9Eb9092fcB5 -n bsc -V 0.8.11 block: 26857408 rpckey: BSC_RPC_URL apikey: BSC_API_KEY # - name: Compound -# args: 0x75442Ac771a7243433e033F3F8EaB2631e22938f 0x374ABb8cE19A73f2c4EFAd642bda76c797f19233 -t 0x6C8c6b02E7b2BE14d4fA6022Dfd6d75921D90E4E,0xc00e94Cb662C3520282E6f5717214004A7f26888 -p 0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B -u -v 0.8.10 -T --token-holder 0x309d413391e975B553B7B8D19bC11F8a6c2eB889 +# args: 0x75442Ac771a7243433e033F3F8EaB2631e22938f 0x374ABb8cE19A73f2c4EFAd642bda76c797f19233 -t 0x6C8c6b02E7b2BE14d4fA6022Dfd6d75921D90E4E,0xc00e94Cb662C3520282E6f5717214004A7f26888 -p 0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B -u -V 0.8.10 -T --token-holder 0x309d413391e975B553B7B8D19bC11F8a6c2eB889 # block: 13322797 # rpckey: ETHEREUM_RPC_URL # apikey: ETHEREUM_API_KEY - name: AnkrRewardEarningBNB - args: 0xE380B02b16e050c2801CcA83461916FEca652ecF 0x952398318838b4915ee5E800622a9613887759f5 -p 0xfe39985D7eFF914c50A06bA0cFfcCA8361e00C0e -t 0x52F24a5e03aee338Da5fd9Df68D2b6FAe1178827:0x2c00CE1a935FF8c9e78580533e2E17c36281c26E -T -n bsc -v 0.8.16 + args: 0xE380B02b16e050c2801CcA83461916FEca652ecF 0x952398318838b4915ee5E800622a9613887759f5 -p 0xfe39985D7eFF914c50A06bA0cFfcCA8361e00C0e -t 0x52F24a5e03aee338Da5fd9Df68D2b6FAe1178827:0x2c00CE1a935FF8c9e78580533e2E17c36281c26E -T -n bsc -V 0.8.16 block: 28261629 rpckey: BSC_RPC_URL apikey: BSC_API_KEY - name: DeusFinanceDEI - args: 0x1472b3081d81b792e697aea90accbbc4adc5baf9 0xbc1b62db243b51dabcd9540473324f36e094ec55 -p 0xde1e704dae0b4051e80dabb26ab6ad6c12262da0 -n arbi -v 0.8.4 + args: 0x1472b3081d81b792e697aea90accbbc4adc5baf9 0xbc1b62db243b51dabcd9540473324f36e094ec55 -p 0xde1e704dae0b4051e80dabb26ab6ad6c12262da0 -n arbi -V 0.8.4 block: 87626025 rpckey: ARBITRUM_RPC_URL apikey: ARBITRUM_API_KEY diff --git a/.github/workflows/ci-path-mode.yml b/.github/workflows/ci-path-mode.yml index 44912e3..97f4296 100644 --- a/.github/workflows/ci-path-mode.yml +++ b/.github/workflows/ci-path-mode.yml @@ -16,11 +16,11 @@ jobs: include: - name: Safemoon out: ./contracts/test/safemoon/ - args: ./diffusc/tests/test_data/safemoon/SafemoonV2.sol ./diffusc/tests/test_data/safemoon/SafemoonV3.sol -p ./diffusc/tests/test_data/safemoon/TransparentProxyTestHarness.sol -v 0.8.11 --run-custom ./contracts/test/safemoon/DiffFuzzCustomInit.sol DiffFuzzInit + args: ./diffusc/tests/test_data/safemoon/SafemoonV2.sol ./diffusc/tests/test_data/safemoon/SafemoonV3.sol -p ./diffusc/tests/test_data/safemoon/TransparentProxyTestHarness.sol -V 0.8.11 --run-custom ./contracts/test/safemoon/DiffFuzzCustomInit.sol DiffFuzzInit - name: Compound out: ./contracts/test/compound - args: ./contracts/implementation/compound/compound-0.8.10/ComptrollerHarnessV1.sol ./contracts/implementation/compound/compound-0.8.10/ComptrollerHarnessV2.sol -t ./contracts/implementation/compound/compound-0.8.10/CErc20.sol,./contracts/implementation/compound/compound-0.8.10/CompHarness.sol -p ./contracts/implementation/compound/compound-0.8.10/Unitroller.sol -u -v 0.8.10 --run-custom ./contracts/test/compound/DiffFuzzCustomInit.sol DiffFuzzCustomInit + args: ./contracts/implementation/compound/compound-0.8.10/ComptrollerHarnessV1.sol ./contracts/implementation/compound/compound-0.8.10/ComptrollerHarnessV2.sol -t ./contracts/implementation/compound/compound-0.8.10/CErc20.sol,./contracts/implementation/compound/compound-0.8.10/CompHarness.sol -p ./contracts/implementation/compound/compound-0.8.10/Unitroller.sol -u -V 0.8.10 --run-custom ./contracts/test/compound/DiffFuzzCustomInit.sol DiffFuzzCustomInit steps: - name: Checkout repository diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml index 627635c..52eae0e 100644 --- a/.github/workflows/mypy.yml +++ b/.github/workflows/mypy.yml @@ -28,7 +28,7 @@ jobs: python-version: '3.10' - name: Install mypy - run: python3 -m pip install mypy==1.2.0 types-requests + run: python3 -m pip install mypy==1.2.0 types-requests types-setuptools - name: Install dependencies run: pip3 install -r requirements.txt diff --git a/README.md b/README.md index c4d4879..67cc92e 100644 --- a/README.md +++ b/README.md @@ -124,7 +124,8 @@ Additional options unlock greater functionality: * `--senders`: Explicitly specify a list of sender addresses to use (in fork mode). Echidna defaults to `0x1000`, `0x2000` and `0x3000`. * `--min-token-balance`: The minimum token balance required when searching for holders (default 10000). * `--max-token-holders`: The maximum number of holders to find per token (default 5). -* `-v, --version`: The solc compiler version to use (default 0.8.0). +* `-V, --solc-version`: The solc compiler version to use (default 0.8.0). +* `-v, --version`: The current version of Diffusc. * `-u, --fuzz-upgrade`: Flag to include an upgrade function in test contract, to upgrade to V2 mid-transaction sequence (default false). * `-P, --protected`: Flag to include test wrappers for protected functions, i.e., with modifier like `onlyOwner` (default false). * `-x, --external-taint`: Flag to analyze external calls to find tainted external contracts (default false). diff --git a/diffusc/core/code_generation.py b/diffusc/core/code_generation.py index b47cb88..580f3ec 100644 --- a/diffusc/core/code_generation.py +++ b/diffusc/core/code_generation.py @@ -435,7 +435,7 @@ def wrap_low_level_call( target = camel_case(c_data["name"]) else: target = camel_case(proxy["name"]) - if not self._fork: + if not self._fork or proxy is None: target += c_data["suffix"] _, call_args, _, _ = self.get_args_and_returns_for_wrapping(func) wrapped = "" @@ -936,7 +936,7 @@ def generate_test_contract(self, diff: Diff, output_dir: str = "./") -> str: CryticPrint.print_information("\n* Generating exploit contract...") # Add solidity pragma and SPDX to avoid warnings - final_contract += f"// SPDX-License-Identifier: AGPLv3\npragma solidity ^{version};\n\n" + final_contract += f"// SPDX-License-Identifier: AGPLv3\npragma solidity >={version};\n\n" try: # Check the major version number, and include abi encoder if below 0.8.0 major_version = int(self._version.split(".")[1]) diff --git a/diffusc/core/fork_mode.py b/diffusc/core/fork_mode.py index 3f4b7ed..908b7c1 100644 --- a/diffusc/core/fork_mode.py +++ b/diffusc/core/fork_mode.py @@ -201,7 +201,12 @@ def analyze_contracts(self) -> None: ) if is_address(self._proxy_address): self._proxy = get_contract_data_from_address( - self._proxy_address, "", self._provider, self.net_info + self._proxy_address, + "", + self._provider, + self.net_info, + is_main_proxy=True, + main_proxy_impl=self._v2, ) if not self._proxy["valid_data"]: CryticPrint.print_error( diff --git a/diffusc/core/hybrid_mode.py b/diffusc/core/hybrid_mode.py index 79eb96c..d01a38d 100644 --- a/diffusc/core/hybrid_mode.py +++ b/diffusc/core/hybrid_mode.py @@ -213,7 +213,12 @@ def analyze_contracts(self) -> None: ) if is_address(self._proxy_address): self._proxy = get_contract_data_from_address( - self._proxy_address, "", self._network_provider, self.net_info + self._proxy_address, + "", + self._network_provider, + self.net_info, + is_main_proxy=True, + main_proxy_impl=self._v2, ) if not self._proxy["valid_data"]: CryticPrint.print_error( diff --git a/diffusc/diffusc.py b/diffusc/diffusc.py index 401f6a0..e1f5964 100644 --- a/diffusc/diffusc.py +++ b/diffusc/diffusc.py @@ -7,6 +7,7 @@ import os import sys from typing import Sequence, Optional +from pkg_resources import require from solc_select.solc_select import switch_global_version from eth_utils import is_address @@ -54,11 +55,18 @@ def main(_args: Optional[Sequence[str]] = None) -> int: help="Specifies the address to which to deploy the test contract.", ) parser.add_argument( - "-v", - "--version", + "-V", + "--solc-version", dest="version", help="Specifies the solc version to use in the test contract (default is 0.8.0).", ) + parser.add_argument( + "-v", + "--version", + help="Displays the current version of diffusc", + version=require("diffusc")[0].version, + action="version", + ) parser.add_argument( "-u", "--fuzz-upgrade", diff --git a/diffusc/tests/e2e/test_fork_mode.py b/diffusc/tests/e2e/test_fork_mode.py index c37a66d..c597f01 100644 --- a/diffusc/tests/e2e/test_fork_mode.py +++ b/diffusc/tests/e2e/test_fork_mode.py @@ -38,7 +38,7 @@ def test_diffusc_fork_mode() -> None: "bsc", "-b", "26857408", - "-v", + "-V", "0.8.11", "-d", output_dir, diff --git a/diffusc/tests/e2e/test_path_mode.py b/diffusc/tests/e2e/test_path_mode.py index 1d426d0..46bfafd 100644 --- a/diffusc/tests/e2e/test_path_mode.py +++ b/diffusc/tests/e2e/test_path_mode.py @@ -21,7 +21,7 @@ def test_diffusc_path_mode() -> None: os.path.join(TEST_DATA_DIR, "ContractV2.sol"), "-d", output_dir, - "-v", + "-V", "0.8.2", ] assert main(args) == 0 @@ -122,7 +122,7 @@ def test_diffusc_path_run_mode() -> None: os.path.join(safemoon_dir, "SafemoonV3.sol"), "-p", os.path.join(safemoon_dir, "TransparentProxyTestHarness.sol"), - "-v", + "-V", "0.8.11", "-d", output_dir, diff --git a/diffusc/tests/test_data/expected/Expected_ForkMode_0.sol b/diffusc/tests/test_data/expected/Expected_ForkMode_0.sol index a2ed1ee..0acc7d9 100644 --- a/diffusc/tests/test_data/expected/Expected_ForkMode_0.sol +++ b/diffusc/tests/test_data/expected/Expected_ForkMode_0.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPLv3 -pragma solidity ^0.8.11; +pragma solidity >=0.8.11; interface ISafemoonV1 { struct FeeTier { @@ -292,7 +292,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork1); emit SwitchedFork(fork1); hevm.prank(msg.sender); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'initialize()' ) @@ -300,7 +300,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'initialize()' ) @@ -315,7 +315,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork1); emit SwitchedFork(fork1); hevm.prank(msg.sender); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'balanceOf(address)', a ) @@ -323,7 +323,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'balanceOf(address)', a ) @@ -338,7 +338,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork1); emit SwitchedFork(fork1); hevm.prank(msg.sender); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'transfer(address,uint256)', a, b ) @@ -346,7 +346,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'transfer(address,uint256)', a, b ) @@ -361,7 +361,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork1); emit SwitchedFork(fork1); hevm.prank(msg.sender); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'transferFrom(address,address,uint256)', a, b, c ) @@ -369,7 +369,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'transferFrom(address,address,uint256)', a, b, c ) @@ -384,7 +384,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork1); emit SwitchedFork(fork1); hevm.prank(msg.sender); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'totalFees()' ) @@ -392,7 +392,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'totalFees()' ) @@ -407,7 +407,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork1); emit SwitchedFork(fork1); hevm.prank(msg.sender); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'reflectionFromTokenInTiers(uint256,uint256,bool)', a, b, c ) @@ -415,7 +415,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'reflectionFromTokenInTiers(uint256,uint256,bool)', a, b, c ) @@ -430,7 +430,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork1); emit SwitchedFork(fork1); hevm.prank(msg.sender); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'reflectionFromToken(uint256,bool)', a, b ) @@ -438,7 +438,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'reflectionFromToken(uint256,bool)', a, b ) @@ -453,7 +453,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork1); emit SwitchedFork(fork1); hevm.prank(msg.sender); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'tokenFromReflection(uint256)', a ) @@ -461,7 +461,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'tokenFromReflection(uint256)', a ) @@ -476,7 +476,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork1); emit SwitchedFork(fork1); hevm.prank(msg.sender); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'accountTier(address)', a ) @@ -484,7 +484,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'accountTier(address)', a ) @@ -499,7 +499,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork1); emit SwitchedFork(fork1); hevm.prank(msg.sender); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'feeTier(uint256)', a ) @@ -507,7 +507,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'feeTier(uint256)', a ) @@ -522,7 +522,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork1); emit SwitchedFork(fork1); hevm.prank(msg.sender); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'migrate(address,uint256)', a, b ) @@ -530,7 +530,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'migrate(address,uint256)', a, b ) @@ -545,7 +545,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork1); emit SwitchedFork(fork1); hevm.prank(msg.sender); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'feeTiersLength()' ) @@ -553,7 +553,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'feeTiersLength()' ) @@ -568,7 +568,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork1); emit SwitchedFork(fork1); hevm.prank(msg.sender); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'getContractBalance()' ) @@ -576,7 +576,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'getContractBalance()' ) @@ -591,7 +591,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork1); emit SwitchedFork(fork1); hevm.prank(msg.sender); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'mint(address,uint256)', a, b ) @@ -599,7 +599,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'mint(address,uint256)', a, b ) @@ -621,7 +621,7 @@ contract DiffFuzzUpgrades { function Safemoon_burn(address a, uint256 b) public virtual { hevm.selectFork(fork1); emit SwitchedFork(fork1); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'burn(uint256)', a ) @@ -629,7 +629,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'burn(address,uint256)', a, b ) diff --git a/diffusc/tests/test_data/expected/Expected_ForkMode_1.sol b/diffusc/tests/test_data/expected/Expected_ForkMode_1.sol index 11d6345..4164923 100644 --- a/diffusc/tests/test_data/expected/Expected_ForkMode_1.sol +++ b/diffusc/tests/test_data/expected/Expected_ForkMode_1.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPLv3 -pragma solidity ^0.8.11; +pragma solidity >=0.8.11; interface ISafemoonV1 { struct FeeTier { diff --git a/diffusc/tests/test_data/expected/Expected_ForkMode_2.sol b/diffusc/tests/test_data/expected/Expected_ForkMode_2.sol index 7289111..21c8cfc 100644 --- a/diffusc/tests/test_data/expected/Expected_ForkMode_2.sol +++ b/diffusc/tests/test_data/expected/Expected_ForkMode_2.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPLv3 -pragma solidity ^0.8.11; +pragma solidity >=0.8.11; interface ISafemoonV1 { struct FeeTier { @@ -430,7 +430,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork1); emit SwitchedFork(fork1); hevm.prank(msg.sender); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'initialize()' ) @@ -438,7 +438,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'initialize()' ) @@ -453,7 +453,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork1); emit SwitchedFork(fork1); hevm.prank(msg.sender); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'balanceOf(address)', a ) @@ -461,7 +461,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'balanceOf(address)', a ) @@ -476,7 +476,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork1); emit SwitchedFork(fork1); hevm.prank(msg.sender); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'transfer(address,uint256)', a, b ) @@ -484,7 +484,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'transfer(address,uint256)', a, b ) @@ -499,7 +499,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork1); emit SwitchedFork(fork1); hevm.prank(msg.sender); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'transferFrom(address,address,uint256)', a, b, c ) @@ -507,7 +507,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'transferFrom(address,address,uint256)', a, b, c ) @@ -522,7 +522,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork1); emit SwitchedFork(fork1); hevm.prank(msg.sender); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'totalFees()' ) @@ -530,7 +530,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'totalFees()' ) @@ -545,7 +545,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork1); emit SwitchedFork(fork1); hevm.prank(msg.sender); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'reflectionFromTokenInTiers(uint256,uint256,bool)', a, b, c ) @@ -553,7 +553,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'reflectionFromTokenInTiers(uint256,uint256,bool)', a, b, c ) @@ -568,7 +568,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork1); emit SwitchedFork(fork1); hevm.prank(msg.sender); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'reflectionFromToken(uint256,bool)', a, b ) @@ -576,7 +576,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'reflectionFromToken(uint256,bool)', a, b ) @@ -591,7 +591,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork1); emit SwitchedFork(fork1); hevm.prank(msg.sender); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'tokenFromReflection(uint256)', a ) @@ -599,7 +599,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'tokenFromReflection(uint256)', a ) @@ -614,7 +614,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork1); emit SwitchedFork(fork1); hevm.prank(msg.sender); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'accountTier(address)', a ) @@ -622,7 +622,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'accountTier(address)', a ) @@ -637,7 +637,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork1); emit SwitchedFork(fork1); hevm.prank(msg.sender); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'feeTier(uint256)', a ) @@ -645,7 +645,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'feeTier(uint256)', a ) @@ -660,7 +660,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork1); emit SwitchedFork(fork1); hevm.prank(msg.sender); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'migrate(address,uint256)', a, b ) @@ -668,7 +668,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'migrate(address,uint256)', a, b ) @@ -683,7 +683,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork1); emit SwitchedFork(fork1); hevm.prank(msg.sender); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'feeTiersLength()' ) @@ -691,7 +691,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'feeTiersLength()' ) @@ -706,7 +706,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork1); emit SwitchedFork(fork1); hevm.prank(msg.sender); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'getContractBalance()' ) @@ -714,7 +714,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'getContractBalance()' ) @@ -729,7 +729,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork1); emit SwitchedFork(fork1); hevm.prank(msg.sender); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'mint(address,uint256)', a, b ) @@ -737,7 +737,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'mint(address,uint256)', a, b ) @@ -759,7 +759,7 @@ contract DiffFuzzUpgrades { function Safemoon_burn(address a, uint256 b) public virtual { hevm.selectFork(fork1); emit SwitchedFork(fork1); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'burn(uint256)', a ) @@ -767,7 +767,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'burn(address,uint256)', a, b ) diff --git a/diffusc/tests/test_data/expected/Expected_ForkMode_3.sol b/diffusc/tests/test_data/expected/Expected_ForkMode_3.sol index f51965f..149cdd5 100644 --- a/diffusc/tests/test_data/expected/Expected_ForkMode_3.sol +++ b/diffusc/tests/test_data/expected/Expected_ForkMode_3.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPLv3 -pragma solidity ^0.8.11; +pragma solidity >=0.8.11; interface ISafemoonV1 { struct FeeTier { @@ -449,7 +449,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork1); emit SwitchedFork(fork1); hevm.prank(msg.sender); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'initialize()' ) @@ -457,7 +457,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'initialize()' ) @@ -472,7 +472,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork1); emit SwitchedFork(fork1); hevm.prank(msg.sender); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'balanceOf(address)', a ) @@ -480,7 +480,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'balanceOf(address)', a ) @@ -495,7 +495,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork1); emit SwitchedFork(fork1); hevm.prank(msg.sender); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'transfer(address,uint256)', a, b ) @@ -503,7 +503,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'transfer(address,uint256)', a, b ) @@ -518,7 +518,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork1); emit SwitchedFork(fork1); hevm.prank(msg.sender); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'transferFrom(address,address,uint256)', a, b, c ) @@ -526,7 +526,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'transferFrom(address,address,uint256)', a, b, c ) @@ -541,7 +541,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork1); emit SwitchedFork(fork1); hevm.prank(msg.sender); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'totalFees()' ) @@ -549,7 +549,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'totalFees()' ) @@ -564,7 +564,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork1); emit SwitchedFork(fork1); hevm.prank(msg.sender); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'reflectionFromTokenInTiers(uint256,uint256,bool)', a, b, c ) @@ -572,7 +572,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'reflectionFromTokenInTiers(uint256,uint256,bool)', a, b, c ) @@ -587,7 +587,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork1); emit SwitchedFork(fork1); hevm.prank(msg.sender); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'reflectionFromToken(uint256,bool)', a, b ) @@ -595,7 +595,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'reflectionFromToken(uint256,bool)', a, b ) @@ -610,7 +610,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork1); emit SwitchedFork(fork1); hevm.prank(msg.sender); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'tokenFromReflection(uint256)', a ) @@ -618,7 +618,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'tokenFromReflection(uint256)', a ) @@ -632,14 +632,14 @@ contract DiffFuzzUpgrades { function Safemoon_excludeFromReward(address a) public virtual { hevm.selectFork(fork1); emit SwitchedFork(fork1); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'excludeFromReward(address)', a ) ); hevm.selectFork(fork2); emit SwitchedFork(fork2); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'excludeFromReward(address)', a ) @@ -653,14 +653,14 @@ contract DiffFuzzUpgrades { function Safemoon_includeInReward(address a) public virtual { hevm.selectFork(fork1); emit SwitchedFork(fork1); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'includeInReward(address)', a ) ); hevm.selectFork(fork2); emit SwitchedFork(fork2); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'includeInReward(address)', a ) @@ -674,14 +674,14 @@ contract DiffFuzzUpgrades { function Safemoon_whitelistAddress(address a, uint256 b) public virtual { hevm.selectFork(fork1); emit SwitchedFork(fork1); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'whitelistAddress(address,uint256)', a, b ) ); hevm.selectFork(fork2); emit SwitchedFork(fork2); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'whitelistAddress(address,uint256)', a, b ) @@ -696,7 +696,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork1); emit SwitchedFork(fork1); hevm.prank(msg.sender); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'accountTier(address)', a ) @@ -704,7 +704,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'accountTier(address)', a ) @@ -718,14 +718,14 @@ contract DiffFuzzUpgrades { function Safemoon_setEcoSystemFeePercent(uint256 a, uint256 b) public virtual { hevm.selectFork(fork1); emit SwitchedFork(fork1); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'setEcoSystemFeePercent(uint256,uint256)', a, b ) ); hevm.selectFork(fork2); emit SwitchedFork(fork2); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'setEcoSystemFeePercent(uint256,uint256)', a, b ) @@ -739,14 +739,14 @@ contract DiffFuzzUpgrades { function Safemoon_setLiquidityFeePercent(uint256 a, uint256 b) public virtual { hevm.selectFork(fork1); emit SwitchedFork(fork1); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'setLiquidityFeePercent(uint256,uint256)', a, b ) ); hevm.selectFork(fork2); emit SwitchedFork(fork2); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'setLiquidityFeePercent(uint256,uint256)', a, b ) @@ -760,14 +760,14 @@ contract DiffFuzzUpgrades { function Safemoon_setTaxFeePercent(uint256 a, uint256 b) public virtual { hevm.selectFork(fork1); emit SwitchedFork(fork1); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'setTaxFeePercent(uint256,uint256)', a, b ) ); hevm.selectFork(fork2); emit SwitchedFork(fork2); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'setTaxFeePercent(uint256,uint256)', a, b ) @@ -781,14 +781,14 @@ contract DiffFuzzUpgrades { function Safemoon_setOwnerFeePercent(uint256 a, uint256 b) public virtual { hevm.selectFork(fork1); emit SwitchedFork(fork1); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'setOwnerFeePercent(uint256,uint256)', a, b ) ); hevm.selectFork(fork2); emit SwitchedFork(fork2); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'setOwnerFeePercent(uint256,uint256)', a, b ) @@ -802,14 +802,14 @@ contract DiffFuzzUpgrades { function Safemoon_setBurnFeePercent(uint256 a, uint256 b) public virtual { hevm.selectFork(fork1); emit SwitchedFork(fork1); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'setBurnFeePercent(uint256,uint256)', a, b ) ); hevm.selectFork(fork2); emit SwitchedFork(fork2); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'setBurnFeePercent(uint256,uint256)', a, b ) @@ -823,14 +823,14 @@ contract DiffFuzzUpgrades { function Safemoon_setEcoSystemFeeAddress(uint256 a, address b) public virtual { hevm.selectFork(fork1); emit SwitchedFork(fork1); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'setEcoSystemFeeAddress(uint256,address)', a, b ) ); hevm.selectFork(fork2); emit SwitchedFork(fork2); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'setEcoSystemFeeAddress(uint256,address)', a, b ) @@ -844,14 +844,14 @@ contract DiffFuzzUpgrades { function Safemoon_setOwnerFeeAddress(uint256 a, address b) public virtual { hevm.selectFork(fork1); emit SwitchedFork(fork1); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'setOwnerFeeAddress(uint256,address)', a, b ) ); hevm.selectFork(fork2); emit SwitchedFork(fork2); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'setOwnerFeeAddress(uint256,address)', a, b ) @@ -865,14 +865,14 @@ contract DiffFuzzUpgrades { function Safemoon_addTier(uint256 a, uint256 b, uint256 c, uint256 d, uint256 e, address f, address g) public virtual { hevm.selectFork(fork1); emit SwitchedFork(fork1); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'addTier(uint256,uint256,uint256,uint256,uint256,address,address)', a, b, c, d, e, f, g ) ); hevm.selectFork(fork2); emit SwitchedFork(fork2); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'addTier(uint256,uint256,uint256,uint256,uint256,address,address)', a, b, c, d, e, f, g ) @@ -887,7 +887,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork1); emit SwitchedFork(fork1); hevm.prank(msg.sender); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'feeTier(uint256)', a ) @@ -895,7 +895,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'feeTier(uint256)', a ) @@ -910,7 +910,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork1); emit SwitchedFork(fork1); hevm.prank(msg.sender); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'migrate(address,uint256)', a, b ) @@ -918,7 +918,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'migrate(address,uint256)', a, b ) @@ -933,7 +933,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork1); emit SwitchedFork(fork1); hevm.prank(msg.sender); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'feeTiersLength()' ) @@ -941,7 +941,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'feeTiersLength()' ) @@ -955,14 +955,14 @@ contract DiffFuzzUpgrades { function Safemoon_updateBurnAddress(address a) public virtual { hevm.selectFork(fork1); emit SwitchedFork(fork1); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'updateBurnAddress(address)', a ) ); hevm.selectFork(fork2); emit SwitchedFork(fork2); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'updateBurnAddress(address)', a ) @@ -977,7 +977,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork1); emit SwitchedFork(fork1); hevm.prank(msg.sender); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'getContractBalance()' ) @@ -985,7 +985,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'getContractBalance()' ) @@ -1000,7 +1000,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork1); emit SwitchedFork(fork1); hevm.prank(msg.sender); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'mint(address,uint256)', a, b ) @@ -1008,7 +1008,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'mint(address,uint256)', a, b ) @@ -1026,7 +1026,7 @@ contract DiffFuzzUpgrades { // This function does nothing with the V1, since setWhitelistMint is new in the V2 hevm.selectFork(fork2); emit SwitchedFork(fork2); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'setWhitelistMint(address)', a ) @@ -1050,7 +1050,7 @@ contract DiffFuzzUpgrades { function Safemoon_burn(address a, uint256 b) public virtual { hevm.selectFork(fork1); emit SwitchedFork(fork1); - (bool successV1, bytes memory outputV1) = address(safemoon).call( + (bool successV1, bytes memory outputV1) = address(safemoonV1).call( abi.encodeWithSignature( 'burn(uint256)', a ) @@ -1058,7 +1058,7 @@ contract DiffFuzzUpgrades { hevm.selectFork(fork2); emit SwitchedFork(fork2); hevm.prank(msg.sender); - (bool successV2, bytes memory outputV2) = address(safemoon).call( + (bool successV2, bytes memory outputV2) = address(safemoonV2).call( abi.encodeWithSignature( 'burn(address,uint256)', a, b ) diff --git a/diffusc/tests/test_data/expected/Expected_ForkMode_4.sol b/diffusc/tests/test_data/expected/Expected_ForkMode_4.sol index b3cd98a..dee498f 100644 --- a/diffusc/tests/test_data/expected/Expected_ForkMode_4.sol +++ b/diffusc/tests/test_data/expected/Expected_ForkMode_4.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPLv3 -pragma solidity ^0.8.11; +pragma solidity >=0.8.11; interface ISafemoonV1 { struct FeeTier { diff --git a/diffusc/tests/test_data/expected/Expected_PathMode_0.sol b/diffusc/tests/test_data/expected/Expected_PathMode_0.sol index e9401f6..9dbe5c9 100644 --- a/diffusc/tests/test_data/expected/Expected_PathMode_0.sol +++ b/diffusc/tests/test_data/expected/Expected_PathMode_0.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPLv3 -pragma solidity ^0.8.2; +pragma solidity >=0.8.2; import { ContractV1 as ContractV1_V1 } from "../ContractV1.sol"; import { ContractV2 as ContractV2_V2 } from "../ContractV2.sol"; diff --git a/diffusc/tests/test_data/expected/Expected_PathMode_1.sol b/diffusc/tests/test_data/expected/Expected_PathMode_1.sol index b78a031..b5854b7 100644 --- a/diffusc/tests/test_data/expected/Expected_PathMode_1.sol +++ b/diffusc/tests/test_data/expected/Expected_PathMode_1.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPLv3 -pragma solidity ^0.8.2; +pragma solidity >=0.8.2; import { ContractV1 as ContractV1_V1 } from "../ContractV1.sol"; import { ContractV2 as ContractV2_V2 } from "../ContractV2.sol"; diff --git a/diffusc/tests/test_data/expected/Expected_PathMode_2.sol b/diffusc/tests/test_data/expected/Expected_PathMode_2.sol index fc85207..cf9e0b8 100644 --- a/diffusc/tests/test_data/expected/Expected_PathMode_2.sol +++ b/diffusc/tests/test_data/expected/Expected_PathMode_2.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPLv3 -pragma solidity ^0.8.2; +pragma solidity >=0.8.2; import { ContractV1 as ContractV1_V1 } from "../ContractV1.sol"; import { ContractV2 as ContractV2_V2 } from "../ContractV2.sol"; diff --git a/diffusc/tests/test_data/expected/Expected_PathMode_3.sol b/diffusc/tests/test_data/expected/Expected_PathMode_3.sol index f99583e..31b78a9 100644 --- a/diffusc/tests/test_data/expected/Expected_PathMode_3.sol +++ b/diffusc/tests/test_data/expected/Expected_PathMode_3.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPLv3 -pragma solidity ^0.8.2; +pragma solidity >=0.8.2; import { ContractV1 as ContractV1_V1 } from "../ContractV1.sol"; import { ContractV2 as ContractV2_V2 } from "../ContractV2.sol"; diff --git a/diffusc/tests/test_data/expected/Expected_PathMode_4.sol b/diffusc/tests/test_data/expected/Expected_PathMode_4.sol index 44782d2..6e34081 100644 --- a/diffusc/tests/test_data/expected/Expected_PathMode_4.sol +++ b/diffusc/tests/test_data/expected/Expected_PathMode_4.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: AGPLv3 -pragma solidity ^0.8.2; +pragma solidity >=0.8.2; import { ContractV1 as ContractV1_V1 } from "../ContractV1.sol"; import { ContractV2 as ContractV2_V2 } from "../ContractV2.sol"; diff --git a/diffusc/tests/unit/utils/test_helpers.py b/diffusc/tests/unit/utils/test_helpers.py index c226e13..302a301 100644 --- a/diffusc/tests/unit/utils/test_helpers.py +++ b/diffusc/tests/unit/utils/test_helpers.py @@ -12,10 +12,10 @@ def test_pragma_from_file() -> None: file = os.path.join(TEST_DATA_DIR, "pragmaA.sol") versions = helpers.get_pragma_versions_from_file(file) - assert versions == ("0.8.0", "0.8.20") + assert versions == ("0.8.0", "0.8.21") file = os.path.join(TEST_DATA_DIR, "pragmaB.sol") versions = helpers.get_pragma_versions_from_file(file) - assert versions == ("0.8.2", "0.8.20") + assert versions == ("0.8.2", "0.8.21") file = os.path.join(TEST_DATA_DIR, "pragmaC.sol") versions = helpers.get_pragma_versions_from_file(file) assert versions == ("0.8.2", "0.8.17") diff --git a/diffusc/tests/unit/utils/test_network_provider.py b/diffusc/tests/unit/utils/test_network_provider.py index da76860..ec047e0 100644 --- a/diffusc/tests/unit/utils/test_network_provider.py +++ b/diffusc/tests/unit/utils/test_network_provider.py @@ -261,7 +261,7 @@ def test_missing_token_holders() -> None: def test_few_token_holders() -> None: rpc_url = os.getenv("GOERLI_RPC_URL") assert rpc_url is not None - net_info = NetworkInfoProvider(rpc_url, 9039011) + net_info = NetworkInfoProvider(rpc_url, 9029011) api_key = os.getenv("GOERLI_API_KEY") assert api_key is not None contract_addr = "0xae4c231A9e2D5db591540e59d6374C3D2c1a2e04" diff --git a/diffusc/utils/from_address.py b/diffusc/utils/from_address.py index e782252..0c04b15 100644 --- a/diffusc/utils/from_address.py +++ b/diffusc/utils/from_address.py @@ -23,6 +23,7 @@ def get_deployed_contract( implementation: str, slither_provider: NetworkSlitherProvider, network_info: NetworkInfoProvider, + is_main_proxy: bool = False, ) -> tuple[Contract, Slither | None, Contract | None]: """Get deployed contract ABI from Slither Will get the correct implementation if the contract is a proxy @@ -36,7 +37,7 @@ def get_deployed_contract( impl_slither = None impl_contract = None - if contract.is_upgradeable_proxy: + if contract.is_upgradeable_proxy and not is_main_proxy: if implementation == "": implementation, contract_data = network_info.get_proxy_implementation( contract, contract_data @@ -59,12 +60,15 @@ def get_deployed_contract( return contract, impl_slither, impl_contract +# pylint: disable=too-many-arguments def get_contract_data_from_address( address: str, implementation: str, slither_provider: NetworkSlitherProvider, network_info: NetworkInfoProvider, suffix: str = "", + is_main_proxy: bool = False, + main_proxy_impl: ContractData = None, ) -> ContractData: """Get a ContractData object from a network address, including Slither object.""" @@ -88,19 +92,25 @@ def get_contract_data_from_address( if contract_data["valid_data"]: contract, impl_slither, impl_contract = get_deployed_contract( - contract_data, implementation, slither_provider, network_info + contract_data, implementation, slither_provider, network_info, is_main_proxy ) contract_data["contract_object"] = contract - if impl_slither and impl_contract: + if (impl_slither and impl_contract) or is_main_proxy: contract_data["is_proxy"] = True + if is_main_proxy and main_proxy_impl: + impl_contract = main_proxy_impl["contract_object"] + impl_slither = main_proxy_impl["slither"] contract_data["implementation_slither"] = impl_slither contract_data["implementation_object"] = impl_contract contract_data["implementation_slot"] = get_proxy_implementation_slot(contract) if contract_data["implementation_slot"] is None: _, proxy_data = network_info.get_proxy_implementation(contract, contract_data) contract_data["implementation_slot"] = proxy_data["implementation_slot"] - contract_data["is_erc20"] = impl_contract.is_erc20() + if impl_contract: + contract_data["is_erc20"] = impl_contract.is_erc20() + else: + contract_data["is_erc20"] = False if implementation != "": contract_data["contract_object"] = contract_data["implementation_object"] contract_data["slither"] = contract_data["implementation_slither"] diff --git a/setup.py b/setup.py index 20e9317..1ca0b45 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ description="Diffusc automatically generates differential fuzz testing contracts for use with Echidna.", url="https://github.com/webthethird/solidity-diff-fuzz-upgrades", author="Trail of Bits", - version="0.1.0", + version="0.1.1", packages=find_packages(), python_requires=">=3.8", install_requires=[