Skip to content

Commit c997b25

Browse files
authored
fix: remove Components.sol (#255)
* fix: remove `Components.sol` * fix: put constants back
1 parent a5ecf5d commit c997b25

File tree

8 files changed

+33
-30
lines changed

8 files changed

+33
-30
lines changed

src/Common.sol

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// SPDX-License-Identifier: MIT
22
pragma solidity >=0.6.2 <0.9.0;
33

4-
import {StdStorage, Vm} from "./Components.sol";
4+
import {StdStorage} from "./StdStorage.sol";
5+
import {Vm} from "./Vm.sol";
56

67
abstract contract CommonBase {
78
// Cheat code address, 0x7109709ECfa91a80626fF3989D68f67F5b1DD12D.
@@ -16,9 +17,6 @@ abstract contract CommonBase {
1617
// Address of the test contract, deployed by the DEFAULT_SENDER.
1718
address internal constant DEFAULT_TEST_CONTRACT = 0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f;
1819

19-
// Create2 factory used by scripts when deploying with create2, https://github.com/Arachnid/deterministic-deployment-proxy.
20-
address internal constant CREATE2_FACTORY = 0x4e59b44847b379578588920cA78FbF26c0B4956C;
21-
2220
uint256 internal constant UINT256_MAX =
2321
115792089237316195423570985008687907853269984665640564039457584007913129639935;
2422

src/Components.sol

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/Script.sol

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,20 @@
22
pragma solidity >=0.6.2 <0.9.0;
33

44
import {CommonBase} from "./Common.sol";
5-
// forgefmt: disable-next-line
6-
import {console, console2, StdChains, StdCheatsSafe, stdJson, stdMath, StdStorage, stdStorageSafe, StdUtils, VmSafe} from "./Components.sol";
5+
import {console} from "./console.sol";
6+
import {console2} from "./console2.sol";
7+
import {StdChains} from "./StdChains.sol";
8+
import {StdCheatsSafe} from "./StdCheats.sol";
9+
import {stdJson} from "./StdJson.sol";
10+
import {stdMath} from "./StdMath.sol";
11+
import {StdStorage, stdStorageSafe} from "./StdStorage.sol";
12+
import {StdUtils} from "./StdUtils.sol";
13+
import {VmSafe} from "./Vm.sol";
714

815
abstract contract ScriptBase is CommonBase {
16+
// Create2 factory used by scripts when deploying with create2, https://github.com/Arachnid/deterministic-deployment-proxy.
17+
address internal constant CREATE2_FACTORY = 0x4e59b44847b379578588920cA78FbF26c0B4956C;
18+
919
VmSafe internal constant vmSafe = VmSafe(VM_ADDRESS);
1020
}
1121

src/StdAssertions.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// SPDX-License-Identifier: MIT
22
pragma solidity >=0.6.2 <0.9.0;
33

4-
import "ds-test/test.sol";
5-
import "./StdMath.sol";
4+
import {DSTest} from "ds-test/test.sol";
5+
import {stdMath} from "./StdMath.sol";
66

77
abstract contract StdAssertions is DSTest {
88
event log_array(uint256[] val);

src/StdCheats.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ pragma solidity >=0.6.2 <0.9.0;
33

44
pragma experimental ABIEncoderV2;
55

6-
import "./StdStorage.sol";
7-
import "./Vm.sol";
6+
import {StdStorage, stdStorage} from "./StdStorage.sol";
7+
import {Vm, VmSafe} from "./Vm.sol";
88

99
abstract contract StdCheatsSafe {
1010
VmSafe private constant vm = VmSafe(address(uint160(uint256(keccak256("hevm cheat code")))));

src/StdJson.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pragma solidity >=0.6.0 <0.9.0;
33

44
pragma experimental ABIEncoderV2;
55

6-
import "./Vm.sol";
6+
import {VmSafe} from "./Vm.sol";
77

88
// Helpers for parsing and writing JSON files
99
// To parse:
@@ -27,7 +27,7 @@ import "./Vm.sol";
2727
// ```
2828

2929
library stdJson {
30-
VmSafe private constant vm = Vm(address(uint160(uint256(keccak256("hevm cheat code")))));
30+
VmSafe private constant vm = VmSafe(address(uint160(uint256(keccak256("hevm cheat code")))));
3131

3232
function parseRaw(string memory json, string memory key) internal pure returns (bytes memory) {
3333
return vm.parseJson(json, key);

src/StdStorage.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: MIT
22
pragma solidity >=0.6.2 <0.9.0;
33

4-
import "./Vm.sol";
4+
import {Vm} from "./Vm.sol";
55

66
struct StdStorage {
77
mapping(address => mapping(bytes4 => mapping(bytes32 => uint256))) slots;

src/Test.sol

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,18 @@
22
pragma solidity >=0.6.2 <0.9.0;
33

44
import {CommonBase} from "./Common.sol";
5-
import "ds-test/test.sol";
6-
// forgefmt: disable-next-line
7-
import {console, console2, StdAssertions, StdChains, StdCheats, stdError, stdJson, stdMath, StdStorage, stdStorage, StdUtils, Vm} from "./Components.sol";
5+
import {DSTest} from "ds-test/test.sol";
6+
import {console} from "./console.sol";
7+
import {console2} from "./console2.sol";
8+
import {StdAssertions} from "./StdAssertions.sol";
9+
import {StdChains} from "./StdChains.sol";
10+
import {StdCheats} from "./StdCheats.sol";
11+
import {stdError} from "./StdError.sol";
12+
import {stdJson} from "./StdJson.sol";
13+
import {stdMath} from "./StdMath.sol";
14+
import {StdStorage, stdStorage} from "./StdStorage.sol";
15+
import {StdUtils} from "./StdUtils.sol";
16+
import {Vm} from "./Vm.sol";
817

918
abstract contract TestBase is CommonBase {}
1019

0 commit comments

Comments
 (0)