Skip to content

Commit b98e7a4

Browse files
committed
use initializer rather than constructor
1 parent a97051f commit b98e7a4

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

src/Base.sol

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ abstract contract CommonConfig is CommonBase {
6464
function _loadConfig(string memory filePath) internal {
6565
console.log("----------");
6666
console.log(string(abi.encodePacked("Loading config from '", filePath, "'")));
67-
config = new StdConfig(filePath);
67+
config = new StdConfig();
68+
config.initialize(filePath);
6869
vm.makePersistent(address(config));
6970
console.log("Config successfully loaded");
7071
console.log("----------");

src/StdConfig.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ contract StdConfig {
6464
mapping(uint256 => mapping(string => string[])) private _stringArraysOf;
6565
mapping(uint256 => mapping(string => bytes[])) private _bytesArraysOf;
6666

67-
// -- CONSTRUCTOR ----------------------------------------------------------
67+
// -- INITIALIZER ----------------------------------------------------------
6868

6969
/// @notice Reads the TOML file and iterates through each top-level key, which is
7070
/// assumed to be a chain name or ID. For each chain, it caches its RPC
@@ -76,7 +76,7 @@ contract StdConfig {
7676
/// parsed as either, the constructor will revert with an error.
7777
///
7878
/// @param configFilePath: The local path to the TOML configuration file.
79-
constructor(string memory configFilePath) public {
79+
function initialize(string memory configFilePath) public {
8080
_filePath = configFilePath;
8181
string memory content = vm.resolveEnv(vm.readFile(configFilePath));
8282
string[] memory chain_keys = vm.parseTomlKeys(content, "$");

0 commit comments

Comments
 (0)