refactor: don't revert deployment on non-existant configs (#15)

At this point, the contracts that need to be deployed do not require
chain specific configurations. The ones provided for local test nodes
are used in tests that don't represent the production deployment.

Hence, there's little point in reverting the deployment if there's no
config for a specific chain.

This commit also moves the `deployer` assignment to the beginning of the
constructor, ensuring that it's set when configs are created.
This commit is contained in:
r4bbit 2023-09-22 12:10:48 +02:00 committed by GitHub
parent 69e0e5eeaf
commit 5772805ad7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 5 deletions

View File

@ -20,13 +20,11 @@ contract DeploymentConfig is Script {
address public immutable deployer; address public immutable deployer;
constructor(address _broadcaster) { constructor(address _broadcaster) {
if (block.chainid == 31_337) {
(ownerTokenConfig, masterTokenConfig) = getOrCreateAnvilEthConfig();
} else {
revert("no network config for this chain");
}
if (_broadcaster == address(0)) revert DeploymentConfig_InvalidDeployerAddress(); if (_broadcaster == address(0)) revert DeploymentConfig_InvalidDeployerAddress();
deployer = _broadcaster; deployer = _broadcaster;
if (block.chainid == 31_337) {
(ownerTokenConfig, masterTokenConfig) = getOrCreateAnvilEthConfig();
}
} }
function getOrCreateAnvilEthConfig() public pure returns (TokenConfig memory, TokenConfig memory) { function getOrCreateAnvilEthConfig() public pure returns (TokenConfig memory, TokenConfig memory) {